home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / telecomm / bbs / bbbbs84.lha / rexx / bbsLOCAL.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-12-21  |  113.2 KB  |  4,429 lines

  1. /*               $VER: bbsLOCAL.rexx 8.3 (21.12.94)
  2. bbsLOCAL.rexx 8.3 © 1990-94 Richard Lee Stockton 21 Dec 94 1:55PM
  3.    - FREELY DISTRIBUTABLE AS LONG AS THIS NOTICE REMAINS -
  4.  
  5.             BBBBS.baud without the BaudBandit stuff
  6.    Will multi-task with BBBBS.baud (within limits, see docs)
  7.  THIS IS THE SYSOP'S VERSION OF BBBBS.baud FOR LOCAL USE ONLY!
  8. */
  9.  
  10. copyright.=''
  11. copyright.1=STRIP(SOURCELINE(2))
  12. copyright.2='
  13. Gramma Software 21305-60th Ave West, Mountlake Terrace WA 98043-2009'
  14. copyright.3='
  15. ARexx portions of this software copyright 1990-93 Richard Lee Stockton'
  16. copyright.4='- FREELY DISTRIBUTABLE as long as this notice remains -'
  17.  
  18. /* If the QuickSortPort not found then try to run setup.rexx */
  19.  
  20. IF ~SHOW('P','QuickSortPort') THEN CALL setup.rexx()
  21. IF ~SHOW('P','QuickSortPort') THEN EXIT
  22.  
  23. IF SHOW('P','BBBBS_LOCAL') THEN
  24.   DO
  25.     SAY 'bbsLOCAL.rexx is already running!'
  26.     EXIT 0
  27.   END
  28.  
  29. CALL OPENPORT('BBBBS_LOCAL')
  30.  
  31. CALL SETCLIP('BBS_mainfiles')
  32. CALL SETCLIP('BBS_mainusers')
  33.  
  34. PARSE VERSION . . cpu .
  35. cpu=RIGHT(cpu,2)/10
  36. IF cpu<1 THEN cpu=1
  37.  
  38. /* BBS Directories (may be created with SETUP option) */
  39. bbs.=''
  40. bbs.1='Information' /* text files from sysop for the user to read */
  41. bbs.6='Scratch'
  42. bbs.7='BBS_HELP'
  43. bbs.8='rexxDoors'
  44. bbs.9='BBS_TEXT'    /* text files for BBS use. WELCOME HELLO, NEW etc. */
  45. bbs.10='FileNotes'
  46. bbs.11='BBS_LIBS'
  47. bbs.12='BBS_MSGS'
  48. bbs.13='Lists'
  49. bbs.14='Numbers'    /* 1st & last messages, mail, files */
  50. bbs.15='Usage'
  51. bbs.16='Logs'
  52. bbs.17='EMailFiles'
  53. bbs.18='EMail'
  54. bbs.19='Users'
  55.  
  56.  
  57. /* VARIABLES */
  58.  
  59. RESET:
  60. bbsprefs.=0 /* start with all prefs OFF */
  61. namemask=COMPRESS(XRANGE(),XRANGE('A','Z')' _-')
  62. alpha.=''
  63. lastread.=0
  64. dirnum=1
  65. linesperpage=20
  66. sortuserflag=0
  67. sortalphaflag=0
  68. savefileflag=0
  69. emailonline=-1
  70. level=0
  71. lastread.=0
  72. totwrit.=0
  73. lastbrowse=0
  74. warnings=0
  75. winnings=0
  76. nonstop=0
  77. libtext=1
  78. newfilesdate=''
  79. newpassword=''
  80. replysubj=''
  81. msgdir=1
  82. menuflag=1
  83. logonflag=1
  84. data.=''
  85. clr=''
  86. lineup='1B'x'M'
  87. lm='Loading Module...'lineup
  88.  
  89.  
  90. /* TEXT - User data structure by line */
  91.  
  92. text.=''
  93. text.1='   Full Name'
  94. text.2='      Street'
  95. text.3='City, ST Zip'
  96. text.4=' Voice Phone'
  97. text.5='    Password'
  98. text.6='    Protocol'
  99. text.7='LinesPerPage'
  100. text.8=' Preferences'
  101. text.9='    Computer'
  102. text.10='   Interests'
  103. text.11='Session Time'
  104. text.12='FirstSession'
  105. text.13='Last Session'
  106. text.14='      UpLoad'
  107. text.15='    Download'
  108. text.16='   Last File'
  109. text.17='Ratio  Email'
  110. text.18='    Winnings'
  111. text.19='       Usage'
  112. text.20='       Level'
  113. text.21='Exclude DIRS'
  114. text.22='   Msgs Read'
  115. text.23='   Msgs Writ'
  116. text.24=' Marked Msgs'
  117. text.25='Marked Files'
  118. text.26='QUICKexclude'
  119. text.27=' CBV numbers'
  120.  
  121.  
  122. /* try to trap everything */
  123.  
  124. SIGNAL ON BREAK_C
  125. OPTIONS RESULTS
  126. OPTIONS FAILAT 999999
  127. SIGNAL ON BREAK_E
  128. SIGNAL ON SYNTAX
  129. SIGNAL ON FAILURE
  130. NUMERIC DIGITS 14
  131.  
  132.  
  133. ARG option .
  134.  
  135. SAY CENTER(copyright.1,75)
  136. CALL config()
  137.  
  138. IF ~EXISTS(bbspath'Numbers/FirstLogon') THEN
  139.   ADDRESS COMMAND 'C:Date >'bbspath'Numbers/FirstLogon'
  140.  
  141. SAY CENTER(copyright.2,75)
  142. SAY CENTER(copyright.3,75)
  143. SAY CENTER(copyright.4,75)
  144. SAY
  145.  
  146.  
  147. IF option='SETUP' THEN
  148.   DO
  149.     SAY 'Making sure all needed directories are here...'
  150.     DO i=1 TO 20
  151.       IF bbs.i~='' THEN CALL MAKEDIR(bbspath||bbs.i)
  152.     END
  153.   END
  154.  
  155. CALL colors(1)
  156. msg.=''
  157. IF readopen(bbspath'Lists/Conferences') THEN
  158.   DO
  159.     DO i=1
  160.       line=READLN(f)
  161.       IF line='END' THEN BREAK
  162.       IF EOF(f) THEN BREAK
  163.       num=WORD(line,1)
  164.       IF DATATYPE(num,'W') THEN msg.num=WORD(line,2)
  165.     END
  166.     CALL CLOSE(f)
  167.   END
  168. IF option='SETUP' THEN
  169.   DO
  170.     DO i=1 TO 99
  171.       IF msg.i~='' THEN CALL MAKEDIR(msgpath||i)
  172.     END
  173.   END
  174.  
  175. courtesy=''
  176. IF EXISTS(bbspath'Lists/Courtesy') THEN
  177.   DO
  178.     IF readopen(bbspath'Lists/Courtesy') THEN
  179.       DO
  180.         DO i=1
  181.           line=READLN(f)
  182.           IF EOF(f) THEN BREAK
  183.           courtesy=courtesy line
  184.         END
  185.         CALL CLOSE(f)
  186.       END
  187.   END
  188.  
  189. dirs.=''
  190. IF readopen(bbspath'Lists/Libraries') THEN
  191.   DO
  192.     DO i=1
  193.       line=READLN(f)
  194.       IF line='END' | EOF(f) THEN LEAVE i
  195.       num=WORD(line,1)
  196.       IF DATATYPE(num,'W') THEN dirs.num=STRIP(WORD(line,2))
  197.     END
  198.     CALL CLOSE(f)
  199.   END
  200. IF option='SETUP' THEN
  201.   DO
  202.     SAY 'Making sure all file library directories are here...'
  203.     DO i=1 TO 99
  204.       IF dirs.i~='' THEN
  205.         DO
  206.           CALL MAKEDIR(libpath||dirs.i)
  207.           CALL MAKEDIR(bbspath'FileNotes/'dirs.i)
  208.         END
  209.     END
  210.   END
  211.  
  212. users=0
  213. CALL sortuserlist()
  214.  
  215. SAY '          The larger the BBS gets, the longer the setup takes...'
  216.  
  217. CALL loadfiles()
  218. CALL set_grand()
  219. CALL loadalpha(1)
  220.  
  221.  
  222. BIG_LOOP:
  223. /** Identify (title) message */
  224. IF EXISTS(bbspath'BBS_TEXT/HELLO') THEN
  225.   DO
  226.     SAY 
  227.     CALL showtext(bbspath'BBS_TEXT/HELLO' 0)
  228.   END
  229. SAY
  230. SAY pen3'Courtesy List:'def
  231. SAY courtesy
  232. SAY
  233.  
  234.  
  235. /* Ask for name */
  236. name=''
  237. DO count=1 TO 3
  238.   name=getinput(1 0 'Please enter name: ')
  239.   name=SPACE(name,1,'_')
  240.   IF name='NEW' THEN LEAVE count
  241.   IF name~='' THEN
  242.     DO
  243.       IF EXISTS(bbspath'Users/'name) THEN LEAVE count
  244.       IF EXISTS(bbspath'Morgue/'name'.lha') THEN
  245.         DO
  246.           SAY
  247.           SAY name 'used to a member of this BBS.'
  248.           SAY 'If that is you, you will have to resurrect yourself...'
  249.           IF getinput(1 1 'Resurrect' name'? (Ny) > ')='Y' THEN
  250.             DO
  251.               dd=WORD(STATEF(bbspath'Morgue/'name'.lha'),5)
  252.               dd=DATE(,dd,'I')
  253.               SAY 'Resurrecting a dead user.  Killed' dd '...'
  254.               ADDRESS COMMAND 'CD' bbspath'0A'x||'lha x Morgue/'name'.lha'
  255.               CALL DELETE(bbspath'Morgue/'name'.lha')
  256.               CALL send2log('RESURRECTED:' name 'who was killed' dd)
  257.               LEAVE count
  258.             END
  259.         END
  260.       IF FIND(exclusion,name)>0 THEN
  261.         DO
  262.           SAY 'Sorry, that is a reserved name.'
  263.           name=''
  264.           ITERATE count
  265.         END
  266.       CALL loadcourtesy()
  267.       IF bbsprefs.7>0 | FIND(courtesy,name)>0 THEN
  268.         DO
  269.           SAY
  270.           SAY 'Welcome' name'!'
  271.           SAY 'You will be automatically validated after you enter your user info.'
  272.           SAY
  273.           LEAVE count
  274.         END
  275.     END
  276.   IF count<3 THEN
  277.     DO
  278.       IF STRIP(name)~='' THEN SAY name 'not found.  Please try again.'
  279.       SAY 'New Users enter NEW to apply for validation.'
  280.     END
  281. END
  282. IF count>3 THEN SIGNAL DONE
  283. CALL checkUser()
  284. IF UPPER(WORD(data.12,3))~='BIRTHDAY:' THEN
  285.   DO
  286.     SAY
  287.     SAY 'Please help us out by entering the following information.'
  288.     CALL getbirth()
  289.     SAY '   Thank you!'
  290.   END
  291. CALL checkclips()
  292. city=docity(data.3)
  293.  
  294. CALL TIME('R')
  295.  
  296. IF RIGHT(WORD(data.12,4),4)=RIGHT(DATE('S'),4) THEN
  297.   DO
  298.     arg=bbspath'BBS_TEXT/BIRTHDAY'
  299.     IF EXISTS(arg) THEN 
  300.       DO
  301.         SAY
  302.         CALL showtext(arg 1)
  303.       END
  304.     SAY
  305.     SAY '***  Happy Birthday,' pen3||data.1||def', and many more!  ***'
  306.     SAY
  307.   END
  308. SAY 
  309.  
  310. CALL SETCLIP('BBS_LOCAL',name)
  311. IF EXISTS('rexx:bbs:LOGON.rexx') THEN CALL bbsLOGON.rexx(name level)
  312. CALL sortlibraries()
  313. CALL sortconferences()
  314. IF FIND(data.8,'QUICK')>0 THEN CALL do_quick(0)
  315.  
  316.  
  317. /*
  318. Opening Display after logon. Seen by all Users ONCE A DAY. It first
  319. looks for a unique yearly data (ie, WELCOME.0704), then daily data
  320. (ie, WELCOME.Fri), and then a simple, everyday 'WELCOME' datafile.
  321. */
  322.  
  323. IF DATE('I')>lastondate THEN
  324.   DO
  325.     SAY
  326.     arg=bbspath'BBS_TEXT/WELCOME.'RIGHT(DATE('S'),4)
  327.     CALL showtext(arg 1)
  328.     SAY
  329.     arg=bbspath'BBS_TEXT/WELCOME.'LEFT(DATE('W'),3)
  330.     CALL showtext(arg 1)
  331.     SAY
  332.     arg=bbspath'BBS_TEXT/WELCOME'
  333.     CALL showtext(arg 1)
  334.  
  335. /*
  336. Looks for files in the format  LEVEL.low-high, ie "LEVEL.50-80" will only
  337. be seen by users with a level >= 50 and <= 80.
  338. */
  339.  
  340.     levels.=''
  341.     IF FileList(bbspath'BBS_TEXT/LEVEL.*',levels)>0 THEN
  342.       DO
  343.         DO ui=1 TO levels.0
  344.           p=LASTPOS('.',levels.ui)
  345.           x=SUBSTR(levels.ui,p+1)
  346.           PARSE VAR x lo'-'hi .
  347.           IF ~DATATYPE(lo,'W') | ~DATATYPE(hi,'W') THEN ITERATE ui
  348.           IF lo>level | hi<level THEN ITERATE ui
  349.           DO
  350.             SAY
  351.             CALL showtext(levels.ui 1)
  352.           END
  353.         END
  354.       END
  355.  
  356. /*
  357. Looks for format UNTIL.YYYYMMDD ie, "UNTIL.19920514"
  358. Deletes any that are previous to "today"
  359. */
  360.  
  361.     untils.=''
  362.     IF FileList(bbspath'BBS_TEXT/UNTIL.*',untils)>0 THEN
  363.       DO
  364.         CALL QSORT(1,untils.0,untils)
  365.         DO ui=1 TO untils.0
  366.           IF RIGHT(untils.ui,8)<DATE('S') THEN CALL DELETE(untils.ui)
  367.           ELSE
  368.             DO
  369.               SAY
  370.               CALL showtext(untils.ui 1)
  371.             END
  372.         END
  373.       END
  374.     DROP untils.
  375.   END
  376.  
  377. IF bbsprefs.1 & ~terseflag THEN
  378.   DO
  379.     IF doGrin()>3 THEN CALL waiting()
  380.     IF EXISTS(bbspath'rexxDoors/Moon.rexx') THEN CALL Moon.rexx()
  381.     IF EXISTS(bbspath'rexxDoors/Time.rexx') THEN CALL Time.rexx()
  382.     IF FIND(UPPER(SHOWLIST('A')),'TODAY')>0 THEN
  383.       DO
  384.         tf=scratch'/TODAY'
  385.         finfo=STATEF(tf)
  386.         IF WORD(finfo,5)~=DATE('I') THEN
  387.           ADDRESS COMMAND 'C:Today091 >'tf
  388.         IF EXISTS(tf) THEN CALL showtext(tf 0)
  389.       END
  390.     SAY
  391.   END
  392.  
  393. IF SHOWDIR(bbspath'Email/'name)~='' THEN CALL readmail(0)
  394. ELSE SAY 'Your mailbox is empty.'
  395. IF ~terseflag THEN
  396.   DO
  397.     IF level>sysoplevel THEN
  398.       DO
  399.         lstmail=WORD(data.17,3)
  400.         IF ~DATATYPE(lstmail,'W') THEN lstmail=0
  401.         IF countcheck('LastMail' 0)>lstmail THEN
  402.           IF getinput(1 1 'Check Email? (Ny) > ')='Y' THEN CALL mailreport()
  403.         IF level<99 THEN
  404.           DO
  405.             SAY
  406.             CALL showtext(bbspath'Email/'sysop'/NEW_FILES' 1)
  407.           END
  408.         SAY
  409.         CALL showtext(bbspath'Lists/NEW_USERS' 1)
  410.         CALL showtext(bbspath'Lists/CBV_USERS' 1)
  411.       END
  412.     CALL logonstats()
  413.     CALL newinfo()
  414.   END
  415. CALL showmarked(1)
  416. CALL setdir(libpath||dirs.1)
  417. logonflag=0
  418.  
  419.  
  420. /***** MAIN *****/
  421.  
  422. IF menu~='ALL' THEN menu='MAIN'
  423.  
  424. RESTART:
  425. SIGNAL ON BREAK_C
  426. SIGNAL ON BREAK_E
  427.  
  428. waitchar=''
  429. string=''
  430. opt=''
  431. IF level<1 THEN menu='NEW'
  432. DO WHILE(opt~='G')
  433.   go=0
  434.   DO WHILE(~go)
  435.     IF waitchar='' | waitchar='?' THEN
  436.       DO
  437.         commands='cghiqsvwxyz!#,'
  438.         IF level>0  THEN commands='abcdefghijlmnoprstuvwxyz!$#&.,+'
  439.         ELSE IF SHOWDIR(bbspath'Email/'name)~='' THEN commands=commands'e'
  440.         IF level>sysoplevel THEN commands=commands'k%^()=;'
  441.         IF level=99 THEN commands=commands'@~'
  442.         commands=commands'?'
  443.         IF menuflag | waitchar='?' | string='?' THEN
  444.           DO
  445.             opt='MENU'
  446.             arg=''
  447.             CALL menus()
  448.           END
  449.         ELSE SAY pen3'COMMANDS:'def commands
  450.       END
  451.     line=''
  452.     line=line||bak2' 'TIME('C')' 'def
  453.     IF menu='ALL' | menu='FILE' THEN
  454.       line=line pen3'FILE_LIBRARY:'plaindir||def
  455.     ELSE IF menu='MSG' THEN line=line pen3'MESSAGES:'def
  456.     ELSE line=line pen3'MAIN:'def
  457.     line=line'  'bbsname
  458.     IF waitchar='' THEN waitchar=getinput(0 0 line' > ')
  459.     PARSE VAR waitchar string' 'arg
  460.     nonstop=0
  461.     string=UPPER(STRIP(string))
  462.     IF clr~='' THEN SAY clr
  463.     x=GETCLIP('BBS_LOCAL_MSG')
  464.     IF x~='' THEN
  465.       DO
  466.         CALL SETCLIP('BBS_LOCAL_MSG')
  467.         SAY
  468.         SAY bak2' Message from BBBBS: 'def
  469.         SAY x
  470.         SAY
  471.         CALL waiting()
  472.       END
  473.     IF string='OFF' | string='BYE' THEN SIGNAL LOGOUT
  474.     IF string='FL' & level>0 THEN CALL bbsFriends.rexx(name colorflag)
  475.     CALL checkalias()
  476.     IF LEFT(string,1)='D' THEN
  477.       IF DATATYPE(SUBSTR(string,2),'W') THEN arg=SUBSTR(string,2) arg
  478.     waitchar=''
  479.     IF DATATYPE(string,'W') THEN
  480.       DO
  481.         IF string>level THEN
  482.           DO
  483.             arg=STRIP(string arg)
  484.             string='D'
  485.           END
  486.         ELSE
  487.           DO
  488.             dirnum=string
  489.             CALL chdir2()
  490.             CALL since()
  491.           END
  492.       END
  493.     IF string='QUICK' & level>0 THEN CALL do_quick(1)
  494.     opt=LEFT(string,1)
  495.     go=1
  496.     IF POS(opt,UPPER(commands))=0 THEN go=0
  497.   END
  498.   t=bbspath'BBS_TEXT/COM.'opt
  499.   IF UPPER(arg)='EDIT' THEN CALL edinfo(t,opt,'Menu Command')
  500.   IF ~terseflag THEN CALL showtext(t 1)
  501.   OPTIONS PROMPT 'Filename: '
  502.   SELECT
  503.     WHEN opt='A' THEN CALL showalpha()
  504.     WHEN opt='B' THEN CALL browse()
  505.     WHEN opt='C' THEN CALL editor(name 3000 'MAIL' sysop . 0 0 'FEEDBACK')
  506.     WHEN opt='D' THEN CALL dload()
  507.     WHEN opt='E' THEN CALL readmail(level>0)
  508.     WHEN opt='F' THEN CALL do_F()
  509.     WHEN opt='H' THEN CALL help('MAIN')
  510.     WHEN opt='I' THEN CALL information()
  511.     WHEN opt='J' THEN CALL jump2rexx()
  512.     WHEN opt='K' THEN CALL killuser()
  513.     WHEN opt='L' THEN CALL list()
  514.     WHEN opt='M' THEN IF menu~='ALL' THEN menu='MSG'
  515.     WHEN opt='N' THEN CALL newfiles()
  516.     WHEN opt='O' THEN CALL otheruser()
  517.     WHEN opt='P' THEN CALL editor(name 3000 'MSG' . . 0 0)
  518.     WHEN opt='R' THEN CALL readmessages()
  519.     WHEN opt='S' THEN CALL bbsSEARCH()
  520.     WHEN opt='U' THEN CALL uload(1)
  521.     WHEN opt='V' THEN CALL showtext(bbspath'Usage/USER.LOG' 1)
  522.     WHEN opt='W' THEN CALL showuserlist()
  523.     WHEN opt='X' THEN CALL switchmenuflag()
  524.     WHEN opt='Y' THEN CALL edituser()
  525.     WHEN opt='Z' THEN CALL counts()
  526.     WHEN opt='~' THEN CALL sysED(1)
  527.     WHEN opt='@' THEN CALL shell()
  528.     WHEN opt='#' THEN CALL switchcolors()
  529.     WHEN opt='$' THEN IF menu='ALL' THEN menu='MAIN'; ELSE menu='ALL'
  530.     WHEN opt='%' THEN CALL editnote()
  531.     WHEN opt='^' THEN CALL readlogs()
  532.     WHEN opt='&' THEN CALL bbsProfiles.rexx(name level sysoplevel 20 1 6000 bbspath)
  533.     WHEN opt=';' THEN CALL changename()
  534.     WHEN opt='(' THEN CALL filereport()
  535.     WHEN opt=')' THEN CALL mailreport()
  536.     WHEN opt='=' THEN CALL levelreport()
  537.     WHEN opt='+' THEN CALL ext_dload()
  538.     WHEN opt='.' THEN menu='MAIN'
  539.     WHEN opt=',' THEN DO;CALL hourly();CALL waiting();END
  540.     WHEN opt='?' & menuflag THEN CALL help('MAIN')
  541.     OTHERWISE NOP
  542.   END
  543. END
  544. SIGNAL LOGOUT
  545. EXIT
  546.  
  547.  
  548.  
  549. /* FUNCTIONS */
  550.  
  551.  
  552. do_F:
  553. IF menu='FILE' | menu='ALL' THEN
  554.   DO
  555.     IF STORAGE()<(bbsprefs.15+100000) | GETCLIP('BBS_libs.0')~='' THEN
  556.       DO
  557.         SAY
  558.         SAY 'Sorry! Not enough memory left for background archiving.'
  559.         SAY 'Please try again in 10 minutes or so.'
  560.         SAY
  561.         RETURN
  562.       END
  563.     DO i=0 TO libs.0
  564.       CALL SETCLIP('BBS_libs.'i,libs.i)
  565.     END
  566.     IF Make_BrowseList.baud(name colorflag files.0)=0 THEN
  567.       IF emailonline>=0 THEN emailonline=emailonline+1
  568.     DO i=0 TO libs.0
  569.       CALL SETCLIP('BBS_libs.'i)
  570.     END
  571.   END
  572. ELSE IF menu~='ALL' THEN menu='FILE'
  573. RETURN
  574.  
  575.  
  576. cleanstring:
  577. PARSE ARG nflag':'cstr
  578. IF nflag=1 THEN
  579.   DO
  580.     cstr=COMPRESS(cstr,"'`")
  581.     cstr=TRANSLATE(cstr,,namemask)
  582.     cstr=SPACE(cstr,1,'_')
  583.     RETURN cstr
  584.   END
  585. bot=XRANGE(,'1F'x)
  586. IF nflag=2 THEN bot=COMPRESS(bot,'1B'x)  /* ESC for ANSI */
  587. ELSE cstr=strip_ansi(cstr)
  588. top=XRANGE('7F'x)
  589. cstr=COMPRESS(cstr,bot||top)
  590. IF nflag=0 THEN cstr=STRIP(cstr)
  591. RETURN cstr
  592.  
  593.  
  594. showtext:
  595. PARSE ARG starg warg .
  596. IF EXISTS(starg) THEN
  597.   DO
  598.     CALL readlines(starg 1)
  599.     IF colorflag=0 THEN CALL strip_lynes()
  600.     CALL seelines(1)
  601.     IF warg THEN
  602.       DO
  603.         CALL waiting()
  604.         nonstop=0
  605.       END
  606.   END
  607. RETURN
  608.  
  609.  
  610. strip_lynes:
  611. DO i=1 TO lynes.0
  612.   lynes.i=strip_ansi(lynes.i)
  613. END
  614. RETURN
  615.  
  616.  
  617. strip_ansi:
  618. PARSE ARG aline 
  619. n=POS('1B'x,aline)
  620. DO WHILE n>0
  621.   DO k=2
  622.     IF DATATYPE(SUBSTR(aline,n+k,1),'M') | (n+k+1)>LENGTH(aline) THEN
  623.       leave k
  624.   END
  625.   aline=DELSTR(aline,n,k+1)
  626.   n=POS('1B'x,aline)
  627. END
  628. RETURN aline
  629.  
  630.  
  631. doGrin:
  632. IF ~EXISTS(bbspath'rexxDoors/Grin_du_Jour.rexx') THEN RETURN 0
  633. CALL setdir(bbspath'rexxDoors')
  634. temp=Grin_du_Jour.rexx()
  635. SAY
  636. RETURN temp
  637.  
  638.  
  639. do_quick:
  640. ARG flag .
  641. IF FIND(UPPER(data.8),'QUICK')=0 THEN
  642.   DO
  643.     SAY
  644.     SAY 'The QUICK option is OFF in your current settings.'
  645.     SAY
  646.     SAY 'Setting the QUICK option to ON will allow you to tell the BBS to'
  647.     SAY 'make a .lha archive of all new bbs activity since your last call.'
  648.     SAY
  649.     SAY 'This archive can then be read (and replied to, and files can be'
  650.     SAY 'uploaded and downloaded) using 'pen3'bbsQUICK.rexx'def', the offline read/reply'
  651.     SAY 'module for BBBBS, which is available here in the file libraries.'
  652.     SAY
  653.     IF getinput(1 1 'Turn the QUICK option ON? (Ny) > ')~='Y' THEN RETURN
  654.     data.8=data.8 'QUICK'
  655.     CALL saveData(0)
  656.   END
  657. ELSE IF flag=1 THEN
  658.   DO
  659.     IF getinput(1 1 'Turn the QUICK option OFF? (Ny) > ')='Y' THEN
  660.       DO 
  661.         temp=data.8
  662.         data.8=''
  663.         DO i=1 TO WORDS(temp)
  664.           IF WORD(temp,i)~='QUICK' THEN data.8=STRIP(data.8 WORD(temp,i))
  665.         END
  666.         ADDRESS COMMAND 'c:delete' bbspath'EmailFiles/'name'/QUICK_#?'
  667.         RETURN
  668.       END
  669.   END
  670. IF getinput(1 1 'Edit your QUICK exclude list? (Ny) > ')='Y' THEN
  671.   DO
  672.     SAY
  673.     SAY 'You may EXCLUDE any of these from your QUICK archives.'
  674.     SAY pen3||LEFT('-',74,'-')||def
  675.     temp=LEFT(' ',7)
  676.     SAY temp'HELLO          - Pre-logon message.'
  677.     SAY temp'WELCOME        - Post-logon message.'
  678.     SAY temp'GOODBYE        - Logoff message.'
  679.     SAY temp'HOURLY         - Average-Minutes-Per-Hour usage graph.'
  680.     SAY temp'STATS.BBS      - Most of the Z command from the main menu.'
  681.     SAY temp'filename       - ANY filename in the Information area.'
  682.     SAY temp'MESSAGES       - New conference messages.'
  683.     SAY temp'FILELIST       - New file descriptions.'
  684.     SAY pen3||LEFT('-',74,'-')||def
  685.     SAY 'Enter a space separated list of what you wish to exclude.'
  686.     SAY pen3'Exclude:'def data.26
  687.     temp=getinput(1 0 pen3'Exclude: 'def)
  688.     IF temp='' & data.26~='' THEN
  689.       DO
  690.         IF getinput(1 1 'Clear the QUICK exclude list? (nY) > ')~='N' THEN
  691.           data.26=''
  692.       END
  693.     ELSE data.26=temp
  694.     temp='Your QUICK archives will exclude'pen3
  695.     IF data.26='' THEN temp=temp 'nothing!'
  696.     ELSE temp=temp data.26
  697.     SAY temp||def
  698.     CALL saveData(0)
  699.     SAY
  700.   END
  701. IF GETCLIP('BBS_'name)~='' THEN
  702.   DO
  703.     SAY
  704.     SAY 'The QUICK routines are still working on your archive...'
  705.     SAY 'Please try again later.'
  706.     SAY
  707.     RETURN
  708.   END
  709. quickdir=bbspath'EmailFiles/'name
  710. CALL MAKEDIR(quickdir)
  711. CALL setdir(quickdir)
  712. qdarg=scratch'/dirlist'
  713. ADDRESS COMMAND 'C:list >'qdarg quickdir'/QUICK_#? DATES'
  714. efiles=UPPER(SHOWDIR(quickdir))
  715. qflag=0
  716. das=0
  717. IF getinput(1 1 'Archive new BBS activity now? (Ny) > ')='Y' THEN
  718.   DO
  719.     das=1
  720.     DO i=1 TO WORDS(efiles)
  721.       IF LEFT(WORD(efiles,i),6)='QUICK_' & RIGHT(qarg,4)='.LHA' THEN
  722.         DO
  723.           SAY
  724.           SAY 'There is already a QUICK_xxxxx.LHA file in your mailbox...'
  725.           SAY 'Activity request has been CANCELLED!'
  726.           SAY
  727.           das=0
  728.           LEAVE i
  729.         END
  730.     END
  731.   END
  732. IF das=1 THEN
  733.   DO
  734.     CALL SETCLIP('BBS_city',city)
  735.     CALL SETCLIP('BBS_'name'_26',data.26)
  736.     IF FIND(UPPER(data.26),'STATS.BBS')=0 THEN
  737.       CALL SETCLIP('BBS_statsarg',emailonline grand grand2 files.0)
  738.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  739.       CALL SETCLIP('BBS_'name'_22',data.22)
  740.     CALL MAKEDIR(bbspath'EmailFiles/'name)
  741.     CALL showmarked(0)
  742.     CALL SETCLIP('BBS_QUICKOUT_BAUD',bps)
  743.     ADDRESS AREXX bbsQUICKOUT.rexx name level lastbrowse WORD(data.16,2) data.21
  744.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  745.       DO
  746.         clear_marked=1
  747.         DO i=1 TO level
  748.           IF WORD(data.22,i)~=-1 THEN
  749.             lastread.i=countcheck('LastMessage'i 0)
  750.         END
  751.         SAY
  752.       END
  753.     IF FIND(UPPER(data.26),'FILELIST')=0 THEN
  754.       lastbrowse=countcheck('LastFile' 0)
  755.     newfilesdate=DATE('S') TIME()
  756.     IF writeopen(bbspath'EmailFiles/'name'/Libraries') THEN
  757.       DO
  758.         DO i=1 TO libs.0
  759.           CALL WRITELN(f,libs.i)
  760.         END
  761.         CALL CLOSE(f)
  762.       END
  763.     IF writeopen(bbspath'EmailFiles/'name'/Conferences') THEN
  764.       DO
  765.         DO i=1 TO msgs.0
  766.           CALL WRITELN(f,msgs.i)
  767.         END
  768.         CALL CLOSE(f)
  769.       END
  770.     SAY
  771.     CALL saveData(1)
  772.     qflag=1
  773.   END
  774. IF WORD(STATEF(qdarg),2)>80 THEN
  775.   DO
  776.     CALL showtext(qdarg 0)
  777.     SAY
  778.   END
  779. DO qi=1 TO WORDS(efiles)
  780.   qarg=WORD(efiles,qi)
  781.   IF LEFT(qarg,6)='QUICK_' & RIGHT(qarg,4)='.LHA' THEN
  782.     DO
  783.       SAY qarg 'is' WORD(STATEF(qarg),2) 'bytes.'
  784.       arg=qarg
  785.       DO WHILE dload()=1
  786.       END
  787.       t=''
  788.       DO WHILE t~='N' & t~='Y'
  789.         t=getinput(1 1 'Delete' qarg'? (ny) > ')
  790.       END
  791.       IF t='Y' THEN
  792.         DO
  793.           IF DELETE(quickdir'/'qarg)=1 THEN SAY qarg 'deleted.'
  794.           CALL DELETE(quickdir'/'qarg'.xdl')
  795.           qarg=COMPRESS(UPPER(qarg),'QUICK_.LHA')
  796.           CALL DELETE(bbspath'Email/'name'/BBBBS.'qarg)
  797.         END
  798.     END
  799. END
  800. arg=''
  801. IF getinput(1 1 'Do you have a QUICKIN file to upload? (Ny) > ')='Y' THEN
  802.   DO
  803.     arg='QUICKIN.lha'
  804.     ul=2
  805.     DO WHILE ul=2
  806.       ul=uload(0)
  807.     END
  808.   END
  809. IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') & level>=sysoplevel THEN
  810.   IF getinput(1 1 'Process your QUICKIN archive [N]ow or at [L]ogoff? (Ln) > ')='N' THEN
  811.     DO
  812.       SAY
  813.       SAY 'Please wait, processing QUICKIN archive...'
  814.       CALL bbsQUICKIN.rexx(name level sysoplevel bbsprefs.6)
  815.       CALL checkclips()
  816.       CALL loaddata()
  817.       SAY
  818.     END
  819. IF getinput(1 1 'Logoff Now? (nY) > ')~='N' THEN
  820.   DO
  821.     IF qflag THEN SAY 'Your archive will be waiting next time you call...'
  822.     SAY
  823.     SIGNAL LOGOUT2
  824.   END
  825. IF qflag THEN
  826.   DO
  827.     SAY
  828.     SAY 'Note: You now have no ''new'' files or messages (they are being archived).'
  829.     SAY
  830.     CALL waiting()
  831.   END
  832. RETURN
  833.  
  834.  
  835. killuser:
  836. ARG kname .
  837. IF level<=sysoplevel THEN RETURN
  838. CALL bbsKillUser.rexx(kname)
  839. RETURN
  840.  
  841.  
  842. menus:
  843. IF OPEN(f,bbspath'BBS_TEXT/MENU_'menu'.'colorflag,'R')~=0 THEN
  844.   DO
  845.     m=READCH(f,65000)
  846.     CALL CLOSE(f)
  847.     SAY m
  848.     IF level>sysoplevel THEN
  849.       DO
  850.         SAY ' ['pen3'K'def']ill a user      ['pen3'%'def'] edit filenote  ['pen3'='def'] level report'def
  851.         SAY ' ['pen3'^'def'] view BBS logs  ['pen3'('def'] file report    ['pen3';'def'] change username'def
  852.       END
  853.     IF level=99 THEN
  854.       SAY ' ['pen3'~'def'] online editor  ['pen3'@'def'] dos shell      ['pen3')'def'] email report'def
  855.   END
  856. ELSE IF menu='NEW' THEN
  857.   DO
  858.     SAY pen6'     _________________'def
  859.     SAY pen6'  __/  'pen3'New User Menu'pen6'  \___'def
  860.     SAY pen6' |                        |'def
  861.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  862.     SAY pen6' |'def'   ['pen3'I'def']nformation        'pen6'|'def
  863.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def
  864.     SAY pen6' |'def'   ['pen3'W'def']ho is here        'pen6'|'def
  865.     SAY pen6' |'def'   ['pen3'S'def']earch user list   'pen6'|'def
  866.     SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def
  867.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def
  868.     SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def
  869.     SAY pen6' |'def'   ['pen3'X'def'] toggle menus     'pen6'|'def
  870.     SAY pen6' |'def'   ['pen3'#'def'] toggle color     'pen6'|'def
  871.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP   'pen6'|'def
  872.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP   'pen6'|'def
  873.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def
  874.     SAY pen6' |________________________|'def
  875.     IF SHOWDIR(bbspath'Email/'name)~='' THEN
  876.       DO
  877.         SAY CR
  878.         SAY 'You have unread EMail waiting!'
  879.         SAY 'Enter E to read ['pen3'E'def']mail.'
  880.       END
  881.   END
  882. ELSE IF menu='MSG' THEN
  883.   DO
  884.     SAY pen6'       ____________'def
  885.     SAY pen6'  ____/  'pen3'Messages'pen6'  \_____'def
  886.     SAY pen6' |                       |'def
  887.     SAY pen6' |'def'   ['pen3'H'def']elp              'pen6'|'def
  888.     SAY pen6' |'def'   ['pen3'P'def']ost messages     'pen6'|'def
  889.     SAY pen6' |'def'   ['pen3'R'def']ead messages     'pen6'|'def
  890.     SAY pen6' |'def'   ['pen3'S'def']earch messages   'pen6'|'def
  891.     SAY pen6' |'def'   ['pen3'E'def']mail (private)   'pen6'|'def
  892.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP  'pen6'|'def
  893.     SAY pen6' |'def'   ['pen3'QUICK'def'] options     'pen6'|'def
  894.     SAY pen6' |'def'   ['pen3'FL'def'] Friends List   'pen6'|'def
  895.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP  'pen6'|'def
  896.     IF(level>sysoplevel) THEN DO
  897.     SAY pen6' |'def'   ['pen3'^'def'] view BBS logs   'pen6'|'def
  898.     SAY pen6' |'def'   ['pen3')'def'] email report    'pen6'|'def
  899.     SAY pen6' |'def'   ['pen3'='def'] level report    'pen6'|'def
  900.     SAY pen6' |'def'   ['pen3';'def'] change username 'pen6'|'def;END
  901.     IF(level=99) THEN DO
  902.     SAY pen6' |'def'   ['pen3'~'def'] online editor   'pen6'|'def
  903.     SAY pen6' |'def'   ['pen3'@'def'] dos shell       'pen6'|'def;END
  904.     SAY pen6' |'def'   ['pen3'F'def']iles menu        'pen6'|'def
  905.     SAY pen6' |'def'   ['pen3'.'def'] main menu       'pen6'|'def
  906.     SAY pen6' |_______________________|'def
  907.   END
  908. ELSE IF menu='FILE' THEN
  909.   DO
  910.     SAY pen6'         _________'def
  911.     SAY pen6'  ______/  'pen3'Files'pen6'  \_______'def
  912.     SAY pen6' |                        |'def
  913.     SAY pen6' |'def'   ['pen3'A'def']lphabetic list    'pen6'|'def
  914.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  915.     SAY pen6' |'def'   ['pen3'B'def']rowse filenotes   'pen6'|'def
  916.     SAY pen6' |'def'   ['pen3'N'def']ew files list     'pen6'|'def
  917.     SAY pen6' |'def'   ['pen3'L'def']ist by Library    'pen6'|'def
  918.     SAY pen6' |'def'   ['pen3'F'def']ilelist archives  'pen6'|'def
  919.     SAY pen6' |'def'   ['pen3'S'def']earch files       'pen6'|'def
  920.     SAY pen6' |'def'   ['pen3'U'def']pload             'pen6'|'def
  921.     SAY pen6' |'def'   ['pen3'D'def']ownload           'pen6'|'def
  922.     SAY pen6' |'def'   ['pen3'+'def'] Extra Devices    'pen6'|'def
  923.     IF(level>sysoplevel) THEN DO
  924.     SAY pen6' |'def'   ['pen3'K'def']ill a user        'pen6'|'def
  925.     SAY pen6' |'def'   ['pen3'%'def'] edit filenote    'pen6'|'def
  926.     SAY pen6' |'def'   ['pen3'('def'] file report      'pen6'|'def
  927.     SAY pen6' |'def'   ['pen3';'def'] change username  'pen6'|'def;END
  928.     IF(level=99) THEN
  929.     SAY pen6' |'def'   ['pen3'@'def'] dos shell        'pen6'|'def
  930.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def
  931.     SAY pen6' |'def'   ['pen3'.'def'] main menu        'pen6'|'def
  932.     SAY pen6' |________________________|'def
  933.   END
  934. ELSE IF menu='MAIN' THEN
  935.   DO
  936.     SAY pen6'       _____________'def
  937.     SAY pen6'  ____/  'pen3'Main Menu'pen6'  \_____'def
  938.     SAY pen6' |                        |'def
  939.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def
  940.     SAY pen6' |'def'   ['pen3'I'def']nfomation         'pen6'|'def
  941.     SAY pen6' |'def'   ['pen3'J'def']ump to doorways   'pen6'|'def
  942.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def
  943.     SAY pen6' |'def'   ['pen3'W'def']ho is here list   'pen6'|'def
  944.     SAY pen6' |'def'   ['pen3'S'def']earch userlist    'pen6'|'def
  945.     SAY pen6' |'def'   ['pen3'O'def']ther users info   'pen6'|'def
  946.     SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def
  947.     SAY pen6' |'def'   ['pen3'X'def']pert (no menus)   'pen6'|'def
  948.     SAY pen6' |'def'   ['pen3'#'def'] toggle colors    'pen6'|'def
  949.     SAY pen6' |'def'   ['pen3'$'def'] toggle menu(s)   'pen6'|'def
  950.     SAY pen6' |'def'   ['pen3'&'def'] user profiles    'pen6'|'def
  951.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def
  952.     SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def
  953.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def
  954.     SAY pen6' |'def'   ['pen3'F'def']iles menu         'pen6'|'def
  955.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def
  956.     SAY pen6' |________________________|'def
  957.   END
  958. ELSE IF menu='ALL' THEN
  959.   DO
  960.     SAY pen6'     __________________________________________________________'def
  961.     SAY pen6'  __/   'pen3'Main Menu            File Menu          Message Menu 'pen6'  \__'def
  962.     SAY pen6' |                                                                |'def
  963.     SAY pen6' |'def' ['pen3'H'def']elp               ['pen3'A'def']lphabetical list  ['pen3'P'def']ost messages      'pen6'|'def
  964.     SAY pen6' |'def' ['pen3'I'def']nformation        ['pen3'B'def']rowse filenotes   ['pen3'R'def']ead messages      'pen6'|'def
  965.     SAY pen6' |'def' ['pen3'Z'def'] bbs statiZtics   ['pen3'L'def']ist by Library    ['pen3'E'def']mail (private)    'pen6'|'def
  966.     SAY pen6' |'def' ['pen3'Y'def']our user data     ['pen3'N'def']ew files          ['pen3'C'def']omment to SYSOP   'pen6'|'def
  967.     SAY pen6' |'def' ['pen3'O'def']ther users info   ['pen3'F'def']ilelist archiver  ['pen3'!'def'] YELL for SYSOP   'pen6'|'def
  968.     SAY pen6' |'def' ['pen3'J'def']ump to doorways   ['pen3'+'def'] Extra Devices    ['pen3'X'def']pert (no menus)   'pen6'|'def
  969.     SAY pen6' |'def' ['pen3'S'def']earch menu        ['pen3'D'def']ownload           ['pen3'$'def'] toggle menu(s)   'pen6'|'def
  970.     SAY pen6' |'def' ['pen3'&'def'] user profiles    ['pen3'U'def']pload             ['pen3'#'def'] toggle colors    'pen6'|'def
  971.     SAY pen6' |'def' ['pen3'V'def']iew user log      ['pen3'T'def']ransfer protocol  ['pen3','def'] hourly stats     'pen6'|'def
  972.     SAY pen6' |'def' ['pen3'G'def']oodbye (logoff)   ['pen3'QUICK'def'] options      ['pen3'FL'def'] Friends List    'pen6'|'def
  973.     IF(level>sysoplevel) THEN DO
  974.     SAY pen6' |'def' ['pen3'K'def']ill a user        ['pen3'%'def'] edit filenote    ['pen3'='def'] level report     'pen6'|'def
  975.     SAY pen6' |'def' ['pen3'^'def'] view BBS logs    ['pen3'('def'] file report      ['pen3';'def'] change username  'pen6'|'def;END
  976.     IF(level=99) THEN
  977.     SAY pen6' |'def' ['pen3'~'def'] online editor    ['pen3'@'def'] dos shell        ['pen3')'def'] email report     'pen6'|'def
  978.     SAY pen6' |________________________________________________________________|'def
  979.   END
  980. SAY
  981. RETURN
  982.  
  983.  
  984. help:
  985. ARG helppath .
  986. SAY
  987. SAY 'For more detailed help, use ['pen3'I'def']nformation commmand to read BBBBS.COMMANDS.'
  988. IF helppath='MAIN' THEN
  989.   SAY 'Commands available from the' pen3||menu||def 'menu:'
  990. frontend=bbspath'BBS_HELP/'helppath
  991. backend='.USER'
  992. IF level=0 THEN backend='.NEW'
  993. ELSE IF level=99 THEN backend='.SUPER'
  994. ELSE IF level>sysoplevel THEN backend='.SYSOP'
  995. CALL showtext(frontend||backend 1)
  996. RETURN
  997.  
  998.  
  999. waiting:
  1000. IF waitchar='Q' THEN
  1001.   DO
  1002.     waitchar=''
  1003.     RETURN
  1004.   END
  1005. waitchar=''
  1006. IF nonstop=1 THEN RETURN
  1007. OPTIONS PROMPT pen3'                       RETURN=Continue  'def
  1008. PULL waitchar
  1009. CALL cleanline(1)
  1010. RETURN
  1011.  
  1012.  
  1013. waiting2:
  1014. IF nonstop=1 THEN RETURN 0
  1015. waitchar=getinput(1 1 pen3'   Q=Quit   N=Non-Stop   RETURN=Continue  'def)
  1016. IF waitchar='N' THEN
  1017.   DO
  1018.     nonstop=1
  1019.     SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E        'def
  1020.     SAY
  1021.     CALL DELAY(99)
  1022.     waitchar=''
  1023.   END
  1024. CALL cleanline(1)
  1025. IF waitchar='Q' THEN RETURN 1
  1026. RETURN 0
  1027.  
  1028.  
  1029. busywait:
  1030. ARG bii bi bt 
  1031. IF bbsprefs.21=0 THEN RETURN
  1032. IF bi<1 THEN
  1033.   DO
  1034.     CALL WRITECH(STDOUT,'080808'x)
  1035.     IF ni<1 & i>999998 & wi>999998 THEN SAY
  1036.     RETURN
  1037.   END
  1038. IF bi=1 THEN CALL WRITECH(STDOUT,'   ')
  1039. IF bi//(bii%2)~=0 THEN RETURN
  1040. b=bi//bii
  1041. IF b=0 | b=bii%2 THEN
  1042.   DO
  1043.     tp=RIGHT((bi*100)%bt,2)'%'
  1044.     CALL WRITECH(STDOUT,'080808'x||tp)
  1045.   END
  1046. RETURN
  1047.  
  1048.  
  1049. cleanline:
  1050. ARG lflag .
  1051. IF nonstop=0 & clr~='' THEN
  1052.   DO
  1053.     SAY clr
  1054.     RETURN
  1055.   END
  1056. cline=lineup||LEFT(' ',77)
  1057. IF lflag=1 THEN cline=cline||lineup
  1058. SAY cline
  1059. RETURN
  1060.  
  1061.  
  1062. getinput:
  1063. PARSE ARG upflag' 'oneflag' 'pline
  1064. OPTIONS PROMPT pline
  1065. PARSE PULL inarg
  1066. inarg=STRIP(inarg)
  1067. IF upflag THEN inarg=UPPER(inarg)
  1068. IF oneflag THEN inarg=LEFT(inarg,1)
  1069. RETURN inarg
  1070.  
  1071.  
  1072. docity:
  1073. PARSE ARG citi
  1074. citi=TRANSLATE(citi,'          ','+-.,*/()<>')
  1075. DO i=WORDS(citi) TO 1 BY -1
  1076.   IF DATATYPE(WORD(citi,i),'N') THEN citi=STRIP(DELWORD(citi,i,1))
  1077.   IF UPPER(WORD(citi,i))='USA' THEN citi=STRIP(DELWORD(citi,i,1))
  1078. END
  1079. citi=SPACE(citi,1)
  1080. RETURN STRIP(citi)
  1081.  
  1082.  
  1083. setdir:
  1084. PARSE ARG tempdir
  1085. CALL PRAGMA('D',STRIP(tempdir))
  1086. directory=PRAGMA('D')
  1087. slash=LASTPOS('/',directory)
  1088. IF slash=0 THEN slash=LASTPOS(':',directory)
  1089. plaindir=directory
  1090. IF slash>0 THEN plaindir=SUBSTR(plaindir,slash+1)
  1091. RETURN
  1092.  
  1093.  
  1094. config:
  1095. arg='s:CONFIG.BBS'
  1096. IF ~EXISTS(arg) THEN arg='BBS:BBS_TEXT/CONFIG.BBS'
  1097. IF readlines(arg 1) THEN
  1098.   DO
  1099.     SAY 's:CONFIG.BBS and BBS:BBS_TEXT/CONFIG.BBS are both missing!'
  1100.     SIGNAL DONE2
  1101.   END
  1102. compos=POS('/*',lynes.1)
  1103. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  1104. bbsname=STRIP(lynes.1)
  1105. CALL SETCLIP('BBS_bbsname',bbsname)
  1106. sysop=WORD(lynes.2,1)
  1107. compos=POS('/*',lynes.3)
  1108. IF compos>0 THEN lynes.3=LEFT(lynes.3,compos-1)
  1109. exclusion=STRIP(lynes.3)
  1110. bbsdevice=WORD(lynes.4,1)
  1111. sysoplevel=WORD(lynes.5,1)
  1112. bbspath=WORD(lynes.6,1)
  1113. IF ~EXISTS(bbspath) THEN
  1114.   DO
  1115.     SAY bbspath 'does not exist!'
  1116.     SIGNAL DONE2
  1117.   END
  1118. testchar=RIGHT(bbspath,1)
  1119. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  1120. CALL SETCLIP('BBS_path',bbspath)
  1121. msgpath=WORD(lynes.7,1)
  1122. IF ~EXISTS(msgpath) THEN
  1123.   DO
  1124.     SAY msgpath 'does not exist!'
  1125.     SIGNAL DONE2
  1126.   END
  1127. testchar=RIGHT(msgpath,1)
  1128. IF testchar~='/' & testchar~=':' THEN msgpath=msgpath'/'
  1129. CALL SETCLIP('BBS_msgpath',msgpath)
  1130. msgpath=msgpath'MSG'
  1131. libpath=WORD(lynes.8,1)
  1132. IF ~EXISTS(libpath) THEN
  1133.   DO
  1134.     SAY libpath 'does not exist!'
  1135.     SIGNAL DONE2
  1136.   END
  1137. testchar=RIGHT(libpath,1)
  1138. IF testchar~='/' & testchar~=':' THEN libpath=libpath'/'
  1139. CALL SETCLIP('BBS_libpath',libpath)
  1140. extdevs=''
  1141. DO i=1 TO WORDS(lynes.10)
  1142.   test=WORD(lynes.10,i)
  1143.   IF POS(':',test)=0 THEN ITERATE i
  1144.   IF LEFT(test,2)='/*' THEN LEAVE i
  1145.   extdevs=STRIP(extdevs test)
  1146. END
  1147. SYSTEM_MSG_LIMIT=WORD(lynes.11,1)
  1148. SYSTEM_SPACE_LIMIT=WORD(lynes.12,1)
  1149. maxidle=WORD(lynes.13,1)
  1150. maxbps=WORD(lynes.15,1)
  1151. IF ~DATATYPE(maxbps,'W') THEN maxbps=2400
  1152. CALL SETCLIP('BBS_baud',maxbps)
  1153. DO i=16 TO 41
  1154.   j=i-15
  1155.   bbsprefs.j=STRIP(WORD(lynes.i,1))
  1156. END
  1157. spellpath=WORD(lynes.9,1)
  1158. IF bbsprefs.5 & ~EXISTS(spellpath) THEN
  1159.   DO
  1160.     SAY spellpath 'does not exist!'
  1161.     bbsprefs.5=0
  1162.   END
  1163. IF bbsprefs.10 THEN scratch=bbspath'Scratch'
  1164. ELSE scratch='RAM:Scratch'
  1165. CALL MAKEDIR(scratch)
  1166. IF ~DATATYPE(bbsprefs.16,'W') THEN bbsprefs.16=3
  1167. extension=WORD(lynes.32,1)
  1168. arccom=lynes.33
  1169. compos=POS('/*',lynes.33)
  1170. IF compos>0 THEN lynes.33=LEFT(lynes.33,compos-1)
  1171. arccom=STRIP(lynes.33)
  1172. IF LEFT(extension,1)~='.' THEN
  1173.   DO
  1174.     extension='.lzh'
  1175.     arccom='lharc -m m'
  1176.   END
  1177. real=0
  1178. IF WORD(lynes.43,1)=1 THEN real=1
  1179. RETURN
  1180.  
  1181.  
  1182. readlogs:
  1183. t=getinput(1 1 'Read [D]aily, [N]umbers, or [Q]uick log? (dnq) > ')
  1184. IF t='' THEN RETURN
  1185. IF t='D' THEN
  1186.   DO
  1187.     arg=getinput(1 0 '['pen3'RETURN'def']=TODAY, or enter Log Date ('pen3||DATE('S')||def') > ')
  1188.     IF arg='' THEN arg=DATE('S')
  1189.     arg=bbspath'Logs/log.'arg
  1190.   END
  1191. ELSE IF t='N' THEN arg=bbspath'logs/QUICK.log'
  1192. ELSE IF t='Q' THEN arg=bbspath'logs/Numbers.log'
  1193. ELSE RETURN
  1194. CALL showtext(arg 1)
  1195. RETURN
  1196.  
  1197.  
  1198. loadcourtesy:
  1199. IF courtesyflag=0 & courtesy='' & EXISTS(bbspath'Lists/Courtesy') THEN
  1200.   DO
  1201.     IF readopen(bbspath'Lists/Courtesy') THEN
  1202.       DO
  1203.         SAY 'Checking Courtesy List...'
  1204.         DO i=1
  1205.           line=READLN(f)
  1206.           IF EOF(f) THEN BREAK
  1207.           courtesy=courtesy UPPER(line)
  1208.         END
  1209.         CALL CLOSE(f)
  1210.         MSG ''
  1211.         MSG pen3'Courtesy List:'def
  1212.         MSG courtesy
  1213.       END
  1214.   END
  1215. RETURN
  1216.  
  1217.  
  1218. fileheader:
  1219. SAY 'Filename          Bytes File# Library         KeyWords'
  1220. SAY pen3||LEFT('=',77,'=')||def
  1221. RETURN
  1222.  
  1223.  
  1224. showalpha:
  1225. libtext=0
  1226. IF DATATYPE(arg,'W') THEN
  1227.   DO
  1228.     dirnum=arg
  1229.     arg=''
  1230.     test='Y'
  1231.     IF chdir2()>0 THEN
  1232.       DO
  1233.         libtext=1
  1234.         RETURN
  1235.       END
  1236.   END
  1237. ELSE
  1238.   DO
  1239.     test=getinput(1 1 'Show one library only? (Ny) > ')
  1240.     IF test='Y' THEN
  1241.       DO
  1242.         IF chdir()>0 THEN
  1243.           DO
  1244.             libtext=1
  1245.             RETURN
  1246.           END
  1247.       END
  1248.   END
  1249.  
  1250. showalpha2:
  1251. libtext=1
  1252. IF test='Y' THEN
  1253.   DO
  1254.     lfile=libpath||plaindir'/.'STRIP(LEFT(plaindir,15))
  1255.     IF EXISTS(lfile) THEN
  1256.       DO
  1257.         CALL showtext(lfile 1)
  1258.         nonstop=0
  1259.         RETURN
  1260.       END
  1261.     filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))
  1262.   END
  1263. ELSE filecount=files.0
  1264. SAY '  'filecount 'files.'
  1265. CALL fileheader()
  1266. count=0
  1267. DO wi=1 TO alpha.0
  1268.   CALL busywait(60 wi alpha.0)
  1269.   IF test='Y' THEN
  1270.     DO
  1271.       IF count>=filecount THEN LEAVE wi
  1272.       IF UPPER(LEFT(plaindir,12))~=UPPER(LEFT(WORD(alpha.wi,5),12)) THEN
  1273.         ITERATE wi
  1274.     END
  1275.   jj=WORD(alpha.wi,4)
  1276.   IF jj>level | FIND(data.21,UPPER(dirs.jj))>0 THEN
  1277.     ITERATE wi
  1278.   CALL busywait(4 0)
  1279.   SAY LEFT(alpha.wi,76)
  1280.   count=count+1
  1281.   IF (count+2)//linesperpage=0 & wi<alpha.0 THEN
  1282.     IF waiting2() THEN
  1283.       DO
  1284.         CALL busywait(4 1)
  1285.         LEAVE wi
  1286.       END
  1287.   CALL busywait(4 1)
  1288. END
  1289. CALL busywait(4 0)
  1290. nonstop=0
  1291. IF waitchar~='Q' THEN CALL waiting()
  1292. RETURN
  1293.  
  1294.  
  1295. otheruser:
  1296. SAY lm
  1297. CALL bbsOther.rexx(3000 name sysoplevel real bbspath bbsname)
  1298. RETURN
  1299.  
  1300.  
  1301. changename:
  1302. ARG cname
  1303. IF level<=sysoplevel THEN RETURN
  1304. IF cname='' THEN cname=getinput(1 0 'Current Username (include underscore): ')
  1305. IF readlines(bbspath'Users/'cname 1)>0 THEN RETURN
  1306. IF WORD(lynes.20,1)>level THEN RETURN
  1307. CALL SETCLIP('BBS_oldname',cname)
  1308. CALL ChangeUserName.rexx()
  1309. ncname=GETCLIP('BBS_newname')
  1310. IF name=cname THEN name=ncname
  1311. CALL DELETE(bbspath'Lists/USERS')
  1312. sortuserflag=1
  1313. CALL SETCLIP('BBS_oldname')
  1314. CALL SETCLIP('BBS_newname')
  1315. RETURN ncname
  1316.  
  1317.  
  1318. levelreport:
  1319. SAY lm
  1320. CALL bbsNewUsers.rexx(name level 1 3000)
  1321. RETURN
  1322.  
  1323.  
  1324. filereport:
  1325. SAY 'Searching for mismatches between files and filenotes...'
  1326. DO i=1 TO sysoplevel+1
  1327.   IF dirs.i='' THEN ITERATE
  1328.   SAY dirs.i'                               'lineup
  1329.   rfiles=SHOWDIR(libpath||dirs.i)
  1330.   rnotes=SHOWDIR(bbspath'FileNotes/'dirs.i)
  1331.   IF WORDS(rfiles)~=WORDS(rnotes) THEN
  1332.     DO
  1333.       line='Compare files & filenotes in'pen3 dirs.i||def'. '
  1334.       DO j=1 TO WORDS(rfiles)
  1335.         IF FIND(UPPER(rnotes),UPPER(WORD(rfiles,j)))=0 THEN
  1336.           line=line WORD(rfiles,j)
  1337.       END
  1338.       SAY line
  1339.     END
  1340. END
  1341. SAY '07'x
  1342. CALL waiting()
  1343. RETURN
  1344.  
  1345.  
  1346. mailreport:
  1347. SAY 'Checking ALL pending Email...'
  1348. SAY pen3' - Use CTRL-E to Exit -'def
  1349. SAY
  1350. mailrep=SHOWDIR(bbspath'Email','D')
  1351. mailfil=SHOWDIR(bbspath'EmailFiles','D')
  1352. lastemail=WORD(data.17,3)
  1353. IF ~DATATYPE(lastemail,'W') THEN lastemail=0
  1354. IF lastemail=countcheck('LastMail' 0) THEN
  1355.   DO
  1356.     DROP mailrep. mailfil.
  1357.     RETURN
  1358.   END
  1359. mailynes.=''
  1360. mk=0
  1361. DO mi=1 TO WORDS(mailrep)
  1362.   muser=WORD(mailrep,mi)
  1363.   IF muser=sysop | muser=name THEN ITERATE mi
  1364.   mlist=SHOWDIR(bbspath'Email/'muser)
  1365.   IF WORDS(mlist)>0 THEN SAY lineup||RIGHT(muser,40)
  1366.   DO mj=1 TO WORDS(mlist)
  1367.     fuser=WORD(mlist,mj)
  1368.     IF POS(sysop,fuser)>0 THEN ITERATE mj
  1369.     IF logonflag=0 THEN
  1370.       DO
  1371.         mk=mk+1
  1372.         mailynes.mk=pen3||LEFT(muser,20) 'from'def LEFT(fuser,20) DATE(,WORD(STATEF(bbspath'Email/'muser'/'fuser),5),'I')
  1373.       END
  1374.     IF POS(sysop,fuser)=0 & POS(name,fuser)=0 THEN
  1375.       DO
  1376.         testnum=RIGHT(fuser,LENGTH(fuser)-LASTPOS('.',fuser))
  1377.         IF testnum>emailnum THEN emailnum=testnum
  1378.         IF testnum>lastemail THEN
  1379.           DO
  1380.             CALL showtext(bbspath'Email/'muser'/'fuser 1)
  1381.             SAY
  1382.             SAY
  1383.             IF waitchar='Q' THEN LEAVE mi
  1384.           END
  1385.       END
  1386.   END
  1387.   IF logonflag=0 & FIND(mailfil,muser)>0 THEN
  1388.     DO
  1389.       efilelist=SHOWDIR(bbspath'EmailFiles/'muser)
  1390.       IF WORDS(efilelist)>0 THEN
  1391.         DO
  1392.           mk=mk+1
  1393.           mailynes.mk=pen3||LEFT(muser,20) 'emailfiles'def efilelist
  1394.         END
  1395.     END
  1396. END
  1397. data.17=WORD(data.17,1) WORD(data.17,2) countcheck('LastMail' 0)
  1398. IF mk>0 THEN
  1399.   DO
  1400.     lynes.0=mk
  1401.     DO mi=1 TO mk
  1402.       lynes.mi=mailynes.mi
  1403.     END
  1404.     CALL seelines(1)
  1405.     nonstop=0
  1406.     CALL waiting()
  1407.   END
  1408. ELSE SAY 'No unseen Email pending.'
  1409. DROP mailrep. mailfil. mailynes. mlist
  1410. RETURN
  1411.  
  1412.  
  1413. jump2rexx:
  1414. arg=bbspath'BBS_TEXT/REXXDOORS'
  1415. IF EXISTS(arg) THEN CALL showtext(arg 0)
  1416. SAY lm
  1417. CALL bbsDoors.rexx(3000 name password)
  1418. RETURN
  1419.  
  1420.  
  1421. sortlibraries:
  1422. SAY 'Sorting Libraries...'
  1423. count=0
  1424. sdirs.=''
  1425. DO i=1 TO level
  1426.   IF dirs.i='' THEN ITERATE i
  1427.   count=count+1
  1428.   sdirs.count=dirs.i i
  1429. END
  1430. sdirs.0=count
  1431. IF count>0 THEN CALL QSort(1,count,sdirs)
  1432. count=0
  1433. libs.=''
  1434. DO i=1 TO sdirs.0
  1435.   tempnum=WORD(sdirs.i,2)
  1436.   tempdir=WORD(sdirs.i,1)
  1437.   IF FIND(data.21,UPPER(tempdir))=0 THEN
  1438.     DO
  1439.       string=' '
  1440.       IF tempnum<10 THEN string=string' '
  1441.       string=string || tempnum'. 'LEFT(tempdir,14)
  1442.       count=count+1
  1443.       libs.count=string
  1444.     END
  1445. END
  1446. libs.0=count%4
  1447. IF (count//4)>0 THEN libs.0=libs.0+1
  1448. DO i=1 TO libs.0
  1449.   DO j=1 TO 3
  1450.     k=i+j*libs.0
  1451.     IF k<=count THEN libs.i=libs.i||libs.k
  1452.   END
  1453. END
  1454. RETURN
  1455.  
  1456.  
  1457. sortconferences:
  1458. SAY 'Sorting Conferences...'
  1459. count=0
  1460. smsg.=''
  1461. DO i=1 TO level
  1462.   IF msg.i='' THEN ITERATE i
  1463.   count=count+1
  1464.   smsg.count=msg.i i
  1465. END
  1466. smsg.0=count
  1467. IF count>0 THEN CALL QSort(1,count,smsg)
  1468. count=0
  1469. msgs.=''
  1470. DO i=1 TO smsg.0
  1471.   tempnum=WORD(smsg.i,2)
  1472.   tempdir=WORD(smsg.i,1)
  1473.   IF FIND(data.21,tempnum)=0 THEN
  1474.     DO
  1475.       string=' '
  1476.       IF tempnum<10 THEN string=string' '
  1477.       string=string || tempnum'.'
  1478.       IF WORD(data.22,tempnum)='' | WORD(data.22,tempnum)>=0 THEN
  1479.         string=string LEFT(tempdir,20)
  1480.       ELSE string=string pen2'-OFF-'def LEFT(tempdir,14)
  1481.       count=count+1
  1482.       msgs.count=string
  1483.     END
  1484. END
  1485. msgs.0=count%3
  1486. IF (count//3)>0 THEN msgs.0=msgs.0+1
  1487. DO i=1 TO msgs.0
  1488.   DO j=1 TO 2
  1489.     k=i+j*msgs.0
  1490.     IF k<=count THEN msgs.i=msgs.i msgs.k
  1491.   END
  1492. END
  1493. RETURN
  1494.  
  1495.  
  1496. readmessages:
  1497. CALL SETCLIP('BBSMSG_ARG',colorflag arg)
  1498. CALL bbsMsg.rexx(6000 name password)
  1499. SAY lm
  1500. CALL loaddata()
  1501. CALL checkemail()
  1502. RETURN
  1503.  
  1504.  
  1505. showmarked:
  1506. ARG ff .
  1507. IF WORDS(data.24)<1 THEN RETURN
  1508. fline='These unread conference messages have been ['pen3'M'pen6']arked as addressed to you:'
  1509. IF ff THEN
  1510.   DO
  1511.     SAY
  1512.     SAY pen6||fline||def
  1513.   END
  1514. tempkk=data.24
  1515. DO i=1 TO WORDS(tempkk)
  1516.   tempk=WORD(tempkk,i)
  1517.   PARSE VAR tempk kdir'/'kmsg
  1518.   line=RIGHT(kmsg,6) 'in the'pen3 msg.kdir def'conference'
  1519.   IF EXISTS(msgpath||tempk) THEN
  1520.     DO
  1521.       IF ff THEN SAY line'.'
  1522.       ELSE fline=fline'0A'x||line'.'
  1523.     END
  1524.   ELSE
  1525.     DO
  1526.       line=line 'is missing.'
  1527.       IF ff THEN SAY line
  1528.       ELSE fline=fline'0A'x||line
  1529.       mkw=FIND(data.24,tempk)
  1530.       data.24=STRIP(DELWORD(data.24,mkw,1))
  1531.       CALL savedata(0)
  1532.     END
  1533. END
  1534. IF ff THEN
  1535.   DO
  1536.     CALL waiting()
  1537.     SAY
  1538.   END
  1539. ELSE
  1540.   DO
  1541.     IF writeopen(bbspath'EmailFiles/'name'/Marked')=0 THEN RETURN
  1542.     CALL WRITELN(f,fline)
  1543.     CALL CLOSE(f)
  1544.   END
  1545. RETURN
  1546.  
  1547.  
  1548. readmail:
  1549. ARG fromenu .
  1550. replysubj=''
  1551. IF fromenu THEN SAY lm
  1552. ELSE arg=''
  1553. CALL SETCLIP('BBSMAIL_ARG',fromenu arg)
  1554. CALL bbsMail.rexx(3000 name password)
  1555. x=GETCLIP('LOCAL_email')
  1556. CALL SETCLIP('LOCAL_email')
  1557. If ~DATATYPE(x,'W') THEN RETURN
  1558. IF emailonline>-1 THEN emailonline=emailonline+x
  1559. CALL checkemail()
  1560. RETURN
  1561.  
  1562.  
  1563. checkemail:
  1564. x=GETCLIP('LOCAL_email')
  1565. CALL SETCLIP('LOCAL_email')
  1566. If DATATYPE(x,'W') THEN
  1567.   IF emailonline>-1 THEN emailonline=emailonline+x
  1568. RETURN
  1569.  
  1570.  
  1571. countcheck:
  1572. PARSE ARG fname' 'cknum' '.
  1573. fname=bbspath'Numbers/'fname
  1574. IF ~EXISTS(fname) THEN
  1575.   DO
  1576.     IF cknum=0 THEN RETURN 0
  1577.     IF ~writeopen(fname) THEN RETURN 0
  1578.     CALL WRITELN(f,cknum)
  1579.     CALL CLOSE(f)
  1580.     RETURN cknum
  1581.   END
  1582. IF ~readopen(fname) THEN
  1583.   DO
  1584.     CALL DELAY(99)
  1585.     IF ~readopen(fname) THEN RETURN cknum
  1586.   END
  1587. retval=STRIP(READLN(f))
  1588. CALL CLOSE(f)
  1589. IF ~DATATYPE(retval,'W') THEN retval=0
  1590. IF ~DATATYPE(cknum,'W') THEN cknum=0
  1591. IF retval<cknum THEN
  1592.   DO
  1593.     IF writeopen(fname) THEN
  1594.       DO
  1595.         CALL WRITELN(f,cknum)
  1596.         CALL CLOSE(f)
  1597.         RETURN cknum
  1598.       END
  1599.   END
  1600. RETURN retval
  1601.  
  1602.  
  1603. sysEd:
  1604. IF level<99 THEN RETURN
  1605. arg=getinput(0 0 'Textfile To Edit: ')
  1606. IF arg='' THEN RETURN
  1607. SAY lm
  1608. CALL bbsEd.rexx(1 arg name)
  1609. CALL checkfilechanges()
  1610. RETURN
  1611.  
  1612.  
  1613. editor:
  1614. PARSE ARG edarg
  1615. SAY lm
  1616. IF bbsWrite.rexx(edarg)=0 THEN RETURN
  1617. IF WORD(edarg,3)='MAIL' THEN
  1618.   DO
  1619.     IF emailonline>=0 THEN emailonline=emailonline+1
  1620.   END
  1621. ELSE
  1622.   DO
  1623.     grand=grand+1
  1624.     IF ~DATATYPE(msg.msgdir.0,'W') THEN msg.msgdir.0=1
  1625.     ELSE msg.msgdir.0=msg.msgdir.0+1
  1626.   END
  1627. CALL loaddata()
  1628. RETURN
  1629.  
  1630.  
  1631. edinfo:
  1632. PARSE ARG t1,t2,t3
  1633. IF level<sysoplevel THEN RETURN 0
  1634. IF getinput(1 1 'Edit the'pen3 t2 def||t3 'info file? (Ny) > ')='Y' THEN
  1635.   DO
  1636.     IF ~EXISTS(t) THEN
  1637.       DO
  1638.         IF writeopen(t1)~=0 THEN
  1639.           DO
  1640.             CALL WRITELN(f,TRIM(CENTER('***'pen3 t2 def||t3 '***',75)))
  1641.             CALL WRITELN(f,LEFT('',75,'='))
  1642.             CALL CLOSE(f)
  1643.             CALL DELAY(28)
  1644.           END
  1645.       END
  1646.     CALL bbsEd.rexx(1 t1 name)
  1647.     arg=''
  1648.     RETURN 1
  1649.   END
  1650. RETURN 0
  1651.  
  1652.  
  1653. shell:
  1654. SAY
  1655. olddir=PRAGMA('D')
  1656. DO WHILE(UPPER(opt)~='EXIT')
  1657.   SAY bak2||TIME('C')||def PRAGMA('D')
  1658.   OPTIONS PROMPT pen3'Type EXIT to quit AmigaDOS> 'def
  1659.   PARSE PULL opt' 'arg
  1660.   IF(UPPER(opt)='CD') THEN CALL setdir(arg)
  1661.   ELSE IF EXISTS(opt)~=0 THEN
  1662.     DO
  1663.       IF LEFT(STATEF(opt),3)='DIR' THEN CALL setdir(opt)
  1664.     END
  1665.   ELSE IF opt~='' & UPPER(opt)~='EXIT' THEN
  1666.     ADDRESS COMMAND opt '<* >*' arg
  1667. END
  1668. CALL PRAGMA('D',olddir)
  1669. RETURN
  1670.  
  1671.  
  1672. bbsspace:
  1673. ARG tabspace .
  1674. ADDRESS COMMAND 'C:info >'scratch'/locinfout' bbsdevice
  1675. ok=OPEN(f,scratch'/locinfout','R')
  1676. IF ok=0 THEN RETURN 20
  1677. line=READLN(f)
  1678. line=READLN(f)
  1679. line=READLN(f)
  1680. line=READLN(f)
  1681. CALL CLOSE(f)
  1682. IF tabspace<14 THEN SAY 
  1683. bbsk=WORD(line,4)
  1684. IF ~DATATYPE(bbsk,'N') THEN
  1685.   DO
  1686.     line=bbsdevice 'is not an info compatible device!'
  1687.     SAY pen3||line||def
  1688.     bbsk=0
  1689.     RETURN
  1690.   END
  1691. bbsk=bbsk*512-SYSTEM_SPACE_LIMIT
  1692. IF bbsk<1 THEN bbsk=0
  1693. SAY RIGHT(comma(bbsk),tabspace) 'bytes available for uploads.'
  1694. RETURN
  1695.  
  1696.  
  1697. comma: PROCEDURE
  1698. ARG num .
  1699. t=''
  1700. x=POS('.',num)
  1701. IF x>0 THEN t=SUBSTR(num,x)
  1702. num=num%1
  1703. dgt=LENGTH(num)
  1704. numtext=''
  1705. IF dgt>3 THEN numtext=','RIGHT(num,3)
  1706. IF dgt>6 THEN numtext=','LEFT(RIGHT(num,6),3)||numtext
  1707. IF dgt>9 THEN numtext=','LEFT(RIGHT(num,9),3)||numtext
  1708. IF dgt>12 THEN
  1709.   DO
  1710.     numtext=','LEFT(RIGHT(num,12),3)||numtext
  1711.     numtext=LEFT(num,dgt-12)||numtext
  1712.   END
  1713. ELSE IF dgt>9 THEN numtext=LEFT(num,dgt-9)||numtext
  1714. ELSE IF dgt>6 THEN numtext=LEFT(num,dgt-6)||numtext
  1715. ELSE IF dgt>3 THEN numtext=LEFT(num,dgt-3)||numtext
  1716. ELSE numtext=num
  1717. RETURN numtext||t
  1718.  
  1719.  
  1720. is_here:
  1721. ARG newname 
  1722. CALL WRITECH(STDOUT,'Checking filelist')
  1723. DO wi=1 TO 99
  1724.   IF wi//3=0 THEN CALL WRITECH(STDOUT,'.')
  1725.   IF dirs.wi='' THEN ITERATE wi
  1726.   IF ~EXISTS(bbspath'FileNotes/'dirs.wi'/'newname) THEN ITERATE wi
  1727.   line=pen3'*** File' newname 'already exists here'
  1728.   IF wi<=level THEN line=line 'in the' dirs.wi 'library'
  1729.   line=line'.'def
  1730.   SAY line
  1731.   SAY 'Original uploader should ['pen3'K'def']ill the file before uploading the replacement.'
  1732.   CALL waiting()
  1733.   RETURN 1
  1734. END
  1735. CALL cleanline(1)
  1736. RETURN 0
  1737.  
  1738.  
  1739. uload:
  1740. ARG frommenu
  1741. CALL bbsspace(12)
  1742. SAY
  1743. IF bbsk<1 THEN
  1744.   DO
  1745.     SAY pen3'Upload area is full!'def
  1746.     RETURN 1
  1747.   END
  1748. IF ~SHOW('P','BUILDALPHA') THEN CALL SETCLIP('BBS_UPLOAD')
  1749. IF frommenu & GETCLIP('BBS_UPLOAD')~='' THEN
  1750.   DO
  1751.     SAY pen3'Uploading is temporarily suspended while the filelists are rebuilding.'def
  1752.     CALL waiting()
  1753.     RETURN 1
  1754.   END
  1755. IF arg='' THEN
  1756.   DO
  1757.     frompath=GETCLIP('BBS_frompath')
  1758.     IF frompath='' THEN frompath='RAM:'
  1759.     fdir=''
  1760.     DO loop=1
  1761.       fromfile=GetFile(150,36,frompath,'',' Select File to Upload ')
  1762.       IF fromfile='' THEN RETURN 1
  1763.       IF EXISTS(fromfile) THEN LEAVE loop
  1764.       SAY
  1765.       SAY fromfile 'does not exist!'
  1766.     END
  1767.     x=LASTPOS('/',fromfile)
  1768.     IF x=0 THEN x=POS(':',fromfile)
  1769.     IF x>0 THEN
  1770.       DO
  1771.         arg=SUBSTR(fromfile,x+1)
  1772.         fdir=LEFT(fromfile,x)
  1773.         IF RIGHT(fdir,1)='/' THEN fdir=LEFT(fdir,x-1)
  1774.         CALL SETCLIP('BBS_frompath',fdir)
  1775.       END
  1776.     ELSE arg=fromfile
  1777.   END
  1778. ELSE fromfile=PRAGMA('D')'/'arg
  1779. arg=COMPRESS(arg,' :/,;|#?*()+[]"{}')  /* be sure no illegals here */
  1780. x=LASTPOS('/',fromfile)
  1781. IF x=0 THEN x=LASTPOS(':',fromfile)
  1782. IF x>0 THEN
  1783.   DO
  1784.     IF DATATYPE(SUBSTR(fromfile,x+1),'W') THEN
  1785.       DO
  1786.         SAY 'Whole numbers are not allowed as filenames!'
  1787.         CALL waiting()
  1788.         RETURN 1
  1789.       END
  1790.   END
  1791. tempnum=LENGTH(arg)-16
  1792. DO WHILE tempnum>0 & POS('EMAILFILES',UPPER(PRAGMA('D')))=0
  1793.   temp='          'pen3||arg def'is'pen3 tempnum||def
  1794.   IF tempnum=1 THEN temp=temp 'character'
  1795.   ELSE temp=temp 'characters'
  1796.   temp=temp 'too long for a filename.'
  1797.   SAY temp  
  1798.   arg=getinput(0 0 'Filename: ')
  1799.   arg=cleanstring('0:'arg)
  1800.   arg=COMPRESS(arg,' :/,;|#?*')
  1801.   tempnum=LENGTH(arg)-16
  1802. END
  1803. IF arg='' THEN RETURN 1
  1804. IF frommenu THEN
  1805.   DO
  1806.     IF is_here(arg) THEN RETURN 1
  1807.     IF bbsprefs.6=1 & sysoplevel>level THEN CALL setdir(libpath'Sysops')
  1808.     ELSE
  1809.       DO
  1810.         SAY 'Please select an appropriate library for -' pen3||arg def'-'
  1811.         IF chdir()>0 THEN RETURN
  1812.       END
  1813.   END
  1814. ADDRESS COMMAND 'C:COPY' fromfile PRAGMA('D')'/'arg
  1815. IF TestArc.rexx(PRAGMA('D')'/'arg)>0 THEN
  1816.   DO
  1817.     SAY
  1818.     SAY pen3'***'def arg pen3'failed archive check!'def
  1819.     SAY
  1820.     temp=getinput(1 1 'Do you believe the archive checker made a mistake? (Ny) > ')
  1821.     IF temp~='Y' THEN
  1822.       DO
  1823.         CALL DELETE(arg)
  1824.         SAY
  1825.         RETURN 2
  1826.       END
  1827.   END
  1828. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN 0
  1829. DO ui=sysoplevel+2 TO 100
  1830.   IF UPPER(dirs.ui)=UPPER(plaindir) THEN RETURN 0
  1831. END
  1832. IF frommenu THEN
  1833.   DO
  1834.     DO WHILE editnote(bbspath'FileNotes/'plaindir'/'arg) /* INSIST on a filenote */
  1835.     END
  1836.     CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  1837.   END
  1838. RETURN 0
  1839.  
  1840.  
  1841. findfiles:
  1842. PARSE ARG ffile .
  1843. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN ffile
  1844. wi=0
  1845. IF DATATYPE(ffile,'W') THEN
  1846.   DO
  1847.     IF WORDS(files.ffile)<2 THEN RETURN 0
  1848.     dirtemp=WORD(files.ffile,1)
  1849.     IF finddirnum(dirtemp)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  1850.       DO
  1851.         CALL illegal_access()
  1852.         RETURN 0
  1853.       END
  1854.     CALL setdir(libpath||dirtemp)
  1855.   END
  1856. ELSE IF EXISTS(ffile) THEN
  1857.   DO
  1858.     IF EXISTS(bbspath'FileNotes/'plaindir'/'ffile) THEN
  1859.       DO
  1860.         IF readopen(bbspath'FileNotes/'plaindir'/'ffile)~=0 THEN
  1861.           DO
  1862.             line=READLN(f)
  1863.             CALL CLOSE(f)
  1864.             ffile=WORD(line,2)
  1865.           END
  1866.       END
  1867.   END
  1868. ELSE IF EXISTS(bbspath'Information'ffile) THEN
  1869.   RETURN bbspath'Information/'ffile
  1870. ELSE
  1871.   DO
  1872.     nextfilenum=countcheck('LastFile' 0)+1
  1873.     CALL busywait(4 1)
  1874.     DO ni=nextfilenum TO 0 BY -1
  1875.       IF ni<1 THEN
  1876.         DO
  1877.           CALL busywait(4 0)
  1878.           SAY '***' files.0 'filenames scanned,'pen3 ffile def'was not found!'
  1879.           RETURN 0
  1880.         END
  1881.       IF ni>1 THEN CALL busywait(60 ni nextfilenum)
  1882.       argtemp=WORD(files.ni,2)
  1883.       IF UPPER(argtemp)=UPPER(ffile) THEN
  1884.         DO
  1885.           dirtemp=WORD(files.ni,1)
  1886.           jj=files.ni.0
  1887.           IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  1888.             DO
  1889.               CALL busywait(4 0)
  1890.               CALL illegal_access()
  1891.               RETURN 0
  1892.             END
  1893.           ffile=ni
  1894.           CALL setdir(libpath||dirtemp)
  1895.           LEAVE ni
  1896.         END
  1897.     END
  1898.     CALL busywait(4 0)
  1899.   END
  1900. IF wi=999999 THEN RETURN 0
  1901. ftemp=ffile
  1902. IF DATATYPE(ftemp,'W') THEN ftemp=WORD(files.ftemp,2)
  1903. IF ~EXISTS(ftemp) THEN
  1904.   DO
  1905.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'ftemp)
  1906.     IF WORDS(finfo)>7 THEN ftemp=WORD(finfo,8)
  1907.     IF ~EXISTS(ftemp) THEN
  1908.       DO
  1909.         IF finfo='' THEN SAY '***'pen3 PRAGMA('D')'/'ftemp def'was not found!'
  1910.         ELSE
  1911.           DO
  1912.             SAY
  1913.             SAY '***'pen3 plaindir'/'ftemp def'is not currently available online.'
  1914.             SAY 'Please leave email to your sysop'pen3 sysop||def', to receive this file.'
  1915.             SAY
  1916.           END
  1917.         RETURN 0
  1918.       END
  1919.   END
  1920. RETURN ffile
  1921.  
  1922.  
  1923. illegal_access:
  1924. SAY
  1925. SAY '*** You are not authorized to access' ffile'!'
  1926. SAY '*** Send Email to' sysop 'to receive a higher level.'
  1927. SAY
  1928. RETURN
  1929.  
  1930.  
  1931. ext_dload:
  1932. SAY
  1933. arg=bbsExtDL.baud(name level 3000 linesperpage colorflag extdevs)
  1934. IF arg~='' THEN SAY 'Sorry, LOCAL mode cannot download from the Extra Devices.'
  1935. RETURN
  1936.  
  1937.  
  1938. dload:
  1939. arg=STRIP(arg data.25)
  1940. data.25=''
  1941. errorflag=0
  1942. curdir=PRAGMA('D')
  1943. OPTIONS PROMPT 'File numbers (and/or names): '
  1944. IF arg='' THEN PARSE PULL arg  /* no filename given */
  1945. IF arg='' THEN RETURN 0
  1946. IF findfiles(arg)=0 THEN RETURN 0
  1947. arg=TRANSLATE(arg,'     ',':/,;|')
  1948. IF WORDS(arg)>1 THEN arg=WORD(arg,1)
  1949. IF DATATYPE(arg,'W') THEN
  1950.   DO
  1951.     CALL setdir(libpath||WORD(files.arg,1))
  1952.     arg=WORD(files.arg,2)
  1953.   END
  1954. IF arg~='' THEN           /* check for filename */
  1955.   DO dloadloop=1
  1956.     frompath=GETCLIP('BBS_frompath')
  1957.     IF frompath='' THEN frompath=libpath'SysOps/'
  1958.     notename=bbspath'FileNotes/'plaindir'/'arg
  1959.     IF ~EXISTS(arg) THEN
  1960.       DO
  1961.         finfo=STATEF(notename)
  1962.         IF WORDS(finfo)>7 THEN
  1963.           DO
  1964.             temp=plaindir
  1965.             x=lastslash(WORD(finfo,8))
  1966.             arg=WORD(x,1)
  1967.             CALL setdir(WORD(x,2))
  1968.             plaindir=temp
  1969.           END
  1970.       END
  1971.     topath=PRAGMA('D')
  1972.     num=LASTPOS('/',arg)
  1973.     IF num=0 THEN num=LASTPOS(':',arg)
  1974.     IF num>0 THEN
  1975.       DO
  1976.         topath=LEFT(arg,num)
  1977.         arg=SUBSTR(arg,num+1)
  1978.       END
  1979.     IF RIGHT(topath,1)~=':' & RIGHT(topath,1)~='/' THEN topath=topath'/'
  1980.     SAY ' Select Filename to Copy ' topath||arg 'To:'
  1981.     tofile=GetFile(150,36,frompath,arg,' Select Destination Name ')
  1982.     IF tofile='' THEN
  1983.       DO
  1984.         errorflag=1
  1985.         LEAVE dloadloop
  1986.       END
  1987.     ADDRESS COMMAND 'C:Copy' topath||arg tofile
  1988.     CALL SETCLIP('BBS_frompath',WORD(lastslash(tofile),2))
  1989.     IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN LEAVE dloadloop
  1990.     DO di=sysoplevel+2 TO 100
  1991.       IF UPPER(dirs.di)=UPPER(plaindir) THEN LEAVE dloadloop
  1992.     END
  1993.     IF readlines(notename 1) THEN LEAVE dloadloop
  1994.     dls=WORD(lynes.2,7)
  1995.     IF ~DATATYPE(dls,'W') THEN dls=0
  1996.     lynes.2=STRIP(DELWORD(lynes.2,7,1)) dls+1
  1997.     finfo=STATEF(notename)
  1998.     IF WORDS(finfo)>7 THEN finfo=SUBSTR(finfo,WORDINDEX(finfo,8))
  1999.     ELSE finfo=''
  2000.     CALL DELETE(notename)
  2001.     CALL savelines(notename)
  2002.     CALL DELAY(28)
  2003.     IF finfo~='' THEN ADDRESS COMMAND 'C:FileNote' notename finfo
  2004.     LEAVE dloadloop
  2005.   END
  2006. CALL setdir(curdir)
  2007. IF errorflag THEN SAY pen3'*** Download Failed!'def
  2008. RETURN errorflag
  2009.  
  2010.  
  2011. lastslash:
  2012. PARSE ARG sarg 
  2013. sdir=''
  2014. slash=LASTPOS('/',sarg)
  2015. IF slash>2 THEN sdir=LEFT(sarg,slash-1)
  2016. ELSE
  2017.   DO
  2018.     slash=LASTPOS(':',sarg)
  2019.     IF slash>0 THEN sdir=LEFT(sarg,slash)
  2020.   END
  2021. IF slash>0 THEN sarg=SUBSTR(sarg,slash+1)
  2022. RETURN sarg sdir
  2023.  
  2024.  
  2025. editnote:
  2026. IF arg='' THEN
  2027.   DO
  2028.     PARSE PULL arg .
  2029.     IF arg='' THEN RETURN 0
  2030.   END
  2031. comment=''
  2032. IF ~EXISTS(arg) THEN
  2033.   DO
  2034.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'arg)
  2035.     fromarg=arg
  2036.     fromdir=GETCLIP('BBS_frompath')
  2037.     IF WORDS(finfo)>7 THEN
  2038.       DO
  2039.         temp='Y'
  2040.         fromdir=WORD(finfo,8)
  2041.         fromdir=lastslash(fromdir)
  2042.         fromarg=WORD(fromdir,1)
  2043.         fromdir=WORD(fromdir,2)
  2044.       END
  2045.     ELSE
  2046.       DO
  2047.         IF level<sysoplevel THEN RETURN 0
  2048.         temp=getinput(1 1 'Is this file on an another device? (Nqy)')
  2049.       END
  2050.     IF fromdir='' THEN fromdir='RAM:'
  2051.     IF temp='Y' THEN
  2052.       DO WHILE comment=''
  2053.         comment=GetFile(150,36,fromdir,fromarg,' Select Linked File ')
  2054.         IF comment='' THEN RETURN 0
  2055.         IF ~EXISTS(comment) THEN comment=''
  2056.         ELSE CALL SETCLIP('BBS_frompath',WORD(lastslash(comment),2))
  2057.       END
  2058.     ELSE IF temp~='N' THEN RETURN 0
  2059.   END
  2060. IF comment='' THEN
  2061.   DO
  2062.     arg=findfiles(arg)
  2063.     IF arg=0 THEN RETURN 0
  2064.     IF DATATYPE(arg,'W') THEN arg=WORD(files.arg,2)
  2065.   END
  2066. filedir=plaindir
  2067. slash=LASTPOS('/',arg)
  2068. IF slash=0 THEN slash=LASTPOS(':',arg)
  2069. IF slash>0 THEN
  2070.   DO
  2071.     filedir=LEFT(arg,slash-1)
  2072.     filedir=SUBSTR(filedir,5)
  2073.     arg=SUBSTR(arg,slash+1)
  2074.   END
  2075. ELSE filedir=plaindir
  2076. CALL MAKEDIR(bbspath'FileNotes/'filedir)
  2077. IF ~EXISTS(bbspath'FileNotes/'filedir) THEN
  2078.   DO
  2079.     SAY pen3'*** Failed to open directory!' filedir||def
  2080.     RETURN 0
  2081.   END
  2082. notename=bbspath'FileNotes/'filedir'/'arg
  2083. lynes.=''
  2084. filenum=countcheck('LastFile' 0)
  2085. IF level>sysoplevel THEN firstedit=1
  2086. ELSE firstedit=5
  2087. IF EXISTS(notename) THEN
  2088.   DO
  2089.     IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  2090.     CALL bbsEd.rexx(firstedit notename name)
  2091.     CALL checkfilechanges()
  2092.     RETURN 0
  2093.   END
  2094. IF comment='' THEN filedata=STATEF(libpath||filedir'/'arg)
  2095. ELSE filedata=STATEF(comment)
  2096. IF filedata='' THEN
  2097.   DO
  2098.     IF comment='' THEN line=filedir'/'arg
  2099.     ELSE line=comment
  2100.     SAY line 'does not exist!'
  2101.     RETURN 0
  2102.   END
  2103. bytes=WORD(filedata,2)
  2104. filenum=filenum+1
  2105. lynes.0=4
  2106. lynes.1='File: 'LEFT(filenum,5)' KeyWords:'
  2107. lynes.2='Name: 'LEFT(arg,27)' Size: 'bytes' bytes   Downloads: 0'
  2108. lynes.3='From: 'LEFT(name,27)' Date: 'DATE() TIME('C')'  Lib: 'filedir
  2109. lynes.4=LEFT('',74,'=')
  2110. lynes.1=lynes.1 edkeywords(arg filedir)
  2111. diz='RAM:file_id.diz'
  2112. IF EXISTS(diz) THEN CALL readlines(diz 5)
  2113. CALL DELETE(diz)
  2114. CALL seelines(1)
  2115. edtype=''
  2116. CALL writebuffer(scratch'/NoteLOCAL')
  2117. IF savelines(notename) THEN RETURN 0
  2118. IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  2119. CALL DELETE(libpath||filedir'/.'STRIP(LEFT(filedir,15)))
  2120. fncom='R'
  2121. DO WHILE fncom='R'
  2122.   CALL seelines(1)
  2123.   nonstop=0
  2124.   line='['pen3'E'def']dit'
  2125.   IF level>sysoplevel THEN line=line '['pen3'K'def']ill'
  2126.   line=line '['pen3'R'def']ead ['pen3'S'def']ave'
  2127.   IF level>sysoplevel THEN line=line '(ekrS) 'def
  2128.   ELSE line=line '(erS) 'def
  2129.   fncom=getinput(1 1 line)
  2130.   IF fncom='K' & level>sysoplevel THEN
  2131.     DO
  2132.       SAY 'Killing FileNote..'
  2133.       CALL DELETE(notename)
  2134.       RETURN 1
  2135.     END
  2136.   ELSE IF fncom='E' THEN
  2137.     DO
  2138.       IF bbsEd.rexx(firstedit notename name)>0 THEN RETURN 0
  2139.       CALL readlines(notename 1)
  2140.       CALL checkfilechanges()
  2141.       fncom='R'
  2142.     END
  2143.   ELSE IF fncom~='R' THEN
  2144.     DO
  2145.       SAY 'Adjusting filelist...'
  2146.       IF filenum<1 THEN filenum=1
  2147.       IF GETCLIP('BBS_level')~='' THEN CALL SETCLIP('BBS_localfiles',1)
  2148.       CALL countcheck('LastFile' filenum)
  2149.       files.0=files.0+1
  2150.       newcount=alpha.0+1
  2151.       alpha.0=newcount
  2152.       files.filenum=plaindir arg
  2153.       files.filenum.0=newcount
  2154.       libnum=finddirnum(plaindir)
  2155.       PARSE VAR lynes.1 . 'KeyWords:' keywords
  2156.       alpha.newcount=LEFT(arg,22-LENGTH(WORD(lynes.2,4)))
  2157.       alpha.newcount=alpha.newcount WORD(lynes.2,4) RIGHT(filenum,5)
  2158.       alpha.newcount=alpha.newcount RIGHT(libnum,2) LEFT(plaindir,12)
  2159.       alpha.newcount=alpha.newcount STRIP(LEFT(STRIP(keywords),32))
  2160.       IF EXISTS(bbspath'Lists/Files') THEN
  2161.         x=listOPEN(f,bbspath'Lists/Files','A')
  2162.       ELSE x=listOPEN(f,bbspath'Lists/Files','W')
  2163.       IF x=0 THEN
  2164.         DO
  2165.           SAY '*** Failed to open' bbspath'Lists/Files'
  2166.           savefileflag=1
  2167.           RETURN 0
  2168.         END
  2169.       CALL WRITELN(f,filenum files.filenum)
  2170.       CALL CLOSE(f)
  2171.       IF EXISTS(bbspath'Lists/Files.ALPHA') THEN
  2172.         x=listOPEN(f,bbspath'Lists/Files.ALPHA','A')
  2173.       ELSE x=listOPEN(f,bbspath'Lists/Files.ALPHA','W')
  2174.       IF x=0 THEN
  2175.         DO
  2176.           SAY '*** Failed to open' bbspath'Lists/Files.ALPHA'
  2177.           RETURN 0
  2178.         END
  2179.       CALL WRITELN(f,alpha.newcount)
  2180.       CALL CLOSE(f)
  2181.       sortalphaflag=1
  2182.     END
  2183. END
  2184. RETURN 0
  2185.  
  2186.  
  2187. checkfilechanges:
  2188. x=GETCLIP('BBS_FileChange')
  2189. CALL SETCLIP('BBS_FileChange')
  2190. DO ii=1 TO WORDS(x)
  2191.   fnum=WORD(x,ii)
  2192.   keywords=GETCLIP('BBS_Keywords_'fnum)
  2193.   CALL SETCLIP('BBS_Keywords_'fnum)
  2194.   num=files.fnum.0
  2195.   alpha.num=TRIM(OVERLAY(keywords,alpha.num,47,32))
  2196.   sortalphaflag=1
  2197. END
  2198. RETURN
  2199.  
  2200.  
  2201. edkeywords:
  2202. PARSE ARG kwarg
  2203. templine=''
  2204. DO WHILE LENGTH(templine)<3
  2205.   SAY
  2206.   SAY pen3'Please enter a list of keywords (or a condensed description)'def
  2207.   SAY pen3'to be used in the alphabetic list and by the search routine.'def
  2208.   SAY '    Note that only the first 32 characters will be used.'
  2209.   SAY LEFT('',43)'|'LEFT('',31,'=')'|'
  2210.   templine=getinput(0 0 ' 'RIGHT(STRIP(RIGHT(kwarg,32)),32) pen3'KeyWords: 'def)
  2211.   templine=cleanstring('0:'templine)
  2212.   templine=STRIP(LEFT(templine,32))
  2213.   SAY
  2214. END
  2215. RETURN templine
  2216.  
  2217.  
  2218. loadfiles:
  2219. SAY def
  2220. IF ~listOPEN(f,bbspath'Lists/Files','R') THEN RETURN
  2221. SAY 'Loading filelist...'
  2222. files.=''
  2223. files.0=0
  2224. DO i=1
  2225.   line=READLN(f)
  2226.   IF EOF(f) THEN BREAK
  2227.   num=WORD(line,1)
  2228.   IF DATATYPE(num,'W') THEN
  2229.     DO
  2230.       IF num<100 THEN
  2231.         IF LEFT(WORD(line,3),1)~='.' THEN
  2232.           DO
  2233.             CALL CLOSE(f)
  2234.             SAY
  2235.             SAY 'Your filelists need to be renumbered, running bbsUPDATE.rexx...'
  2236.             CALL bbsUPDATE.rexx()
  2237.             SIGNAL RESET
  2238.           END
  2239.       files.num=WORD(line,2) WORD(line,3)
  2240.     END
  2241. END
  2242. files.0=i-1
  2243. CALL CLOSE(f)
  2244. RETURN
  2245.  
  2246.  
  2247. savefilelist:
  2248. IF level=99 THEN
  2249.   IF getinput(1 1 'Update filelists now? (nY) > ')='N' THEN RETURN
  2250.  
  2251. savefilelist2:
  2252. SIGNAL OFF BREAK_E
  2253. CALL savealphalist()
  2254. filenum=countcheck('LastFile' 0)
  2255. IF filenum<1 THEN
  2256.   DO
  2257.     IF files.0>0 THEN filenum=files.0
  2258.     ELSE RETURN
  2259.   END
  2260. xarg=bbspath'Lists/Files'
  2261. IF ~listOPEN(f,xarg,'W') THEN RETURN
  2262. SAY 'Saving filelist...'
  2263. savefileflag=0
  2264. DO i=1 TO filenum
  2265.   IF files.i~='' THEN CALL WRITELN(f,i files.i)
  2266. END
  2267. CALL CLOSE(f)
  2268. IF SHOW('P','BBBBS') THEN CALL SETCLIP('BBS_localfiles',2)
  2269. RETURN
  2270.  
  2271.  
  2272. loadalpha:
  2273. ARG alflag
  2274. SAY def
  2275. IF alflag THEN CALL checkliblists()
  2276. IF liblist='' THEN alflag=0
  2277. IF ~listOPEN(f,bbspath'Lists/Files.ALPHA','R') THEN RETURN
  2278. SAY 'Loading the alphabetical filelist...'
  2279. alpha.=''
  2280. alpha.0=0
  2281. DO i=1
  2282.   line=READLN(f)
  2283.   IF EOF(f) THEN LEAVE i
  2284.   fnum=WORD(line,3)
  2285.   IF DATATYPE(fnum,'W') THEN
  2286.     DO
  2287.       alpha.i=line
  2288.       files.fnum.0=i
  2289.       IF alflag THEN CALL updateliblists()
  2290.     END
  2291.   ELSE i=i-1
  2292. END
  2293. CALL CLOSE(f)
  2294. tf=bbspath'Lists/Files.ALPHA.add'
  2295. IF EXISTS(tf) & ~SHOW('P','BBSFILE') THEN
  2296.   IF readopen(tf) THEN
  2297.     DO
  2298.       DO i=i
  2299.         line=READLN(f)
  2300.         IF EOF(f) THEN LEAVE i
  2301.         fnum=WORD(line,3)
  2302.         IF DATATYPE(fnum,'W') THEN
  2303.           DO
  2304.             alpha.i=line
  2305.             files.fnum.0=i
  2306.           END
  2307.         ELSE i=i-1
  2308.         IF alflag THEN CALL updateliblists()
  2309.       END
  2310.       CALL CLOSE(f)
  2311.       CALL DELETE(tf)
  2312.       CALL SETCLIP('BBS_resave_local',1)
  2313.     END
  2314. alpha.0=i-1
  2315. IF alflag THEN CALL closeliblists()
  2316. DO i=1 TO 99
  2317.   IF dirs.i='' THEN ITERATE i
  2318.   dname='.'STRIP(LEFT(dirs.i,15))
  2319.   IF files.i='' THEN
  2320.     DO
  2321.       files.i=dirs.i dname
  2322.       files.0=files.0+1
  2323.     END
  2324.   sz=WORD(STATEF(libpath||dirs.i'/'dname),2)
  2325.   IF ~DATATYPE(sz,'W') THEN sz=0
  2326.   x=files.i.0
  2327.   IF ~DATATYPE(x,'W') THEN
  2328.     DO
  2329.       x=alpha.0+1
  2330.       files.i.0=x
  2331.       alpha.0=x
  2332.       CALL SETCLIP('BBS_resave_local',1)
  2333.       CALL DELETE(libpath||dirs.i'/'dname)
  2334.     END
  2335.   alpha.x=LEFT(dname,22-LENGTH(sz)) sz RIGHT(i,5) RIGHT(i,2)
  2336.   alpha.x=alpha.x LEFT(dirs.i,12) 'alphabetical files list CONTENTS'
  2337. END
  2338. IF GETCLIP('BBS_resave_local')=1 THEN
  2339.   DO
  2340.     CALL SETCLIP('BBS_resave_local')
  2341.     sortalphaflag=1
  2342.     CALL savefilelist2()
  2343.   END
  2344. SAY
  2345. RETURN
  2346.  
  2347.  
  2348. savealphalist:
  2349. SIGNAL OFF BREAK_E
  2350. IF GETCLIP('BBS_mainfiles')~='' THEN
  2351.   DO
  2352.     CALL SETCLIP('BBS_mainfiles')
  2353.     CALL loadfiles()
  2354.     CALL loadalpha(0)
  2355.   END
  2356. CALL checkliblists()
  2357. IF sortalphaflag=1 THEN
  2358.   DO
  2359.     SAY 'Alphabetizing' alpha.0 'files...'
  2360.     IF alpha.0>0 THEN CALL QSORT(1,alpha.0,alpha)
  2361.     DO i=1 TO alpha.0
  2362.       fnum=WORD(alpha.i,3)
  2363.       files.fnum.0=i
  2364.     END
  2365.   END
  2366. sortalphaflag=0
  2367. IF files.100~='' THEN
  2368.   DO
  2369.     sz=WORD(STATEF(libpath||WORD(files.100,1)'/'WORD(files.100,2)),2)
  2370.     IF DATATYPE(sz,'W') THEN
  2371.       DO
  2372.         anum=files.100.0
  2373.         alpha.anum=OVERLAY(RIGHT(sz,7),alpha.anum,17,7)
  2374.       END
  2375.   END
  2376. IF files.101~='' THEN
  2377.   DO
  2378.     sz=WORD(STATEF(libpath||WORD(files.101,1)'/'WORD(files.101,2)),2)
  2379.     IF DATATYPE(sz,'W') THEN
  2380.       DO
  2381.         anum=files.101.0
  2382.         alpha.anum=OVERLAY(RIGHT(sz,7),alpha.anum,17,7)
  2383.       END
  2384.   END
  2385. IF ~listOPEN(f,bbspath'Lists/Files.ALPHA','W') THEN RETURN
  2386. SAY 'Saving alphabetical filelists...'
  2387. DO i=1 TO alpha.0
  2388.   ii=WORD(alpha.i,3)
  2389.   IF files.ii='' THEN alpha.i='0 0' ii '100'
  2390.   IF LEFT(alpha.i,4)='0 0 ' THEN ITERATE i
  2391.   CALL WRITELN(f,alpha.i)
  2392.   IF liblist~='' THEN CALL updateliblists()
  2393. END
  2394. CALL CLOSE(f)
  2395. CALL closeliblists()
  2396. CALL bbsALPHA.rexx(files.0 SUBSTR(extension,2) arccom)
  2397. DO i=0 TO 1
  2398.   t=GETCLIP('BBS_10'i)
  2399.   IF t='' THEN ITERATE i
  2400.   CALL SETCLIP('BBS_10'i)
  2401.   num=100+i
  2402.   files.num=TRANSLATE(t,,'/')
  2403.   files.0=files.0+1
  2404.   x=alpha.0+1
  2405.   files.num.0=x
  2406.   alpha.0=x
  2407.   sz=WORD(STATEF(libpath||t),2)
  2408.   IF ~DATATYPE(sz,'W') THEN sz=0
  2409.   dnum=finddirnum(WORD(files.num,1))
  2410.   alpha.x=LEFT(WORD(files.num,2),22-LENGTH(sz)) sz '  'num RIGHT(dnum,2)
  2411.   alpha.x=alpha.x LEFT(dirs.dnum,12)
  2412.   IF i THEN alpha.x=alpha.x 'alphabetical files list CONTENTS'
  2413.   ELSE alpha.x=alpha.x 'alphabetical by library CONTENTS'
  2414.   SAY 'Added file' num t 'to the filelists.'
  2415.   SAY 'Must now resort and resave.'
  2416.   CALL SETCLIP('BBS_resave_local',1)
  2417. END
  2418. RETURN
  2419.  
  2420.  
  2421. listOPEN:
  2422. PARSE ARG fh,listfile,flag
  2423. DO i=0 TO 59 WHILE OPEN(fh,listfile,flag)=0
  2424.   IF i//4=0 THEN SAY 'Waiting' (60-i)*5 'more seconds for' listfile 'to become available...'
  2425.   CALL DELAY(250)
  2426. END
  2427. IF i>59 THEN
  2428.   DO
  2429.     SAY '*** unable to access' listfile 'list.'
  2430.     RETURN 0
  2431.   END
  2432. RETURN 1
  2433.  
  2434.  
  2435. checkliblists:
  2436. SAY 'Checking individual library filelists...'
  2437. liblist=''
  2438. lastlib=0
  2439. cnt.=0
  2440. DO i=1 TO 99
  2441.   IF dirs.i='' THEN ITERATE i
  2442.   finfo=STATEF(libpath||dirs.i'/.'STRIP(LEFT(dirs.i,15)))
  2443.   IF finfo='' THEN liblist=liblist i
  2444.   ELSE
  2445.     DO
  2446.       sz=WORD(finfo,2)
  2447.       num=files.i.0
  2448.       IF DATATYPE(num,'W') THEN
  2449.         alpha.num=OVERLAY(RIGHT(sz,7),alpha.num,17,7)
  2450.     END
  2451. END
  2452. liblist=STRIP(liblist)
  2453. DO j=1 TO WORDS(liblist)
  2454.   tt=WORD(liblist,j)
  2455.   CALL MAKEDIR(libpath||dirs.tt)
  2456.   lf1=libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15))
  2457.   flg='W'
  2458.   IF EXISTS(libpath||dirs.tt'.txt') THEN
  2459.     DO
  2460.       ADDRESS COMMAND 'COPY' libpath||dirs.tt'.txt' lf1
  2461.       flg='A'
  2462.     END
  2463.   IF listOPEN(f,lf1,flg)=0 THEN ITERATE j
  2464.   IF flg='A' THEN CALL WRITELN(f,'')
  2465.   CALL WRITELN(f,'Filename          Bytes File# Library         KeyWords')
  2466.   CALL WRITELN(f,LEFT('=',77,'='))
  2467.   CALL CLOSE(f)
  2468. END
  2469. RETURN
  2470.  
  2471.  
  2472. updateliblists:
  2473. x=FIND(liblist,WORD(alpha.i,4))
  2474. IF x=0 THEN RETURN
  2475. tt=WORD(liblist,x)
  2476. IF tt~=lastlib THEN
  2477.   DO
  2478.     CALL CLOSE(a)
  2479.     lastlib=tt
  2480.     x=OPEN(a,libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15)),'A')
  2481.     IF x=0 THEN
  2482.       DO
  2483.         lastlib=0
  2484.         RETURN
  2485.       END
  2486.   END
  2487. CALL WRITELN(a,alpha.i)
  2488. cnt.tt=cnt.tt+1
  2489. RETURN
  2490.  
  2491.  
  2492. closeliblists:
  2493. CALL CLOSE(a)
  2494. DO i=1 TO WORDS(liblist)
  2495.   tt=WORD(liblist,i)
  2496.   dname='.'STRIP(LEFT(dirs.tt,15))
  2497.   SAY ' 'dname
  2498.   x=OPEN(f,libpath||dirs.tt'/'dname,'A')
  2499.   IF x~=0 THEN
  2500.     DO
  2501.       CALL WRITELN(f,LEFT('-',77,'-'))
  2502.       temp='file'
  2503.       IF cnt.tt~=1 THEN temp=temp's'
  2504.       temp=cnt.tt temp'.  Last updated' DATE() 'at' TIME('C')
  2505.       temp=temp RIGHT(bbsname,76-LENGTH(temp))
  2506.       CALL WRITELN(f,temp)
  2507.       CALL CLOSE(f)
  2508.     END
  2509.   CALL MAKEDIR(bbspath'FileNotes/'dirs.tt)
  2510.   fnote=bbspath'FileNotes/'dirs.tt'/'dname
  2511.   lynes.=''
  2512.   lynes.0=5
  2513.   x=OPEN(f,fnote,'R')
  2514.   IF x=0 THEN CALL SETCLIP('BBS_resave_local',1)
  2515.   ELSE
  2516.     DO
  2517.       DO k=1
  2518.         line=READLN(f)
  2519.         IF EOF(f) THEN LEAVE k
  2520.         lynes.k=line
  2521.       END
  2522.       CALL CLOSE(f)
  2523.       lynes.0=k-1
  2524.     END
  2525.   finfo=STATEF(libpath||dirs.tt'/.'STRIP(LEFT(dirs.tt,15)))
  2526.   bt=WORD(finfo,2)
  2527.   dl=WORD(lynes.2,7)
  2528.   IF ~DATATYPE(dl,'W') THEN dl=0
  2529.   lynes.1='File: 'LEFT(tt,5)' KeyWords: alphabetical files list CONTENTS'
  2530.   lynes.2='Name: 'LEFT(dname,27)' Size:' bt 'bytes  Downloads:' dl
  2531.   lynes.3='From: 'LEFT('BBBBS',27)' Date: 'DATE() TIME('C')'  Lib: 'dirs.tt
  2532.   lynes.4=LEFT('',74,'=')
  2533.   IF lynes.5='' THEN
  2534.     lynes.5='Up to the minute alphabetical filelist of the' dirs.tt 'library.'
  2535.   IF writeopen(fnote) THEN
  2536.     DO
  2537.       DO k=1 TO lynes.0
  2538.         CALL WRITELN(f,lynes.k)
  2539.       END
  2540.       CALL CLOSE(f)
  2541.       SAY LEFT(' ',LENGTH(dname)+2)'1B'x'Mupdated.'
  2542.     END
  2543. END
  2544. RETURN
  2545.  
  2546.  
  2547. viewuser:
  2548. SAY 
  2549. SAY bak2' 'name' 'def
  2550. DO i=1 TO 18
  2551.   stuff=data.i
  2552.   IF i=13 | i=14 THEN stuff=DATE(,data.i,'S')
  2553.   SAY RIGHT(i,2)||pen3 text.i||def':' stuff
  2554. END
  2555. CALL waiting()
  2556. RETURN
  2557.  
  2558.  
  2559. edituser:
  2560. IF level>0 THEN
  2561.   IF getinput(1 1 'Change ['pen3'U'def']ser data or ['pen3'M'def']essage conference access (mU) > ')='M' THEN
  2562.     DO
  2563.       SAY
  2564.       SAY pen3'     - Message Conference Access -'def
  2565.       SAY '[O]ff turns all message conferences OFF.'
  2566.       SAY '[R]eset lets you Reset to ''x'' number of messages back.'
  2567.       SAY 'Set the last message read by you in ALL message conferences'
  2568.       temp=getinput(1 1 ' ['pen3'F'def']irst  ['pen3'L'def']ast  ['pen3'O'def']ff  ['pen3'R'def']eset  ['pen3'Q'def']uit  (florQ) > ')
  2569.       IF POS(temp,'FLOR')=0 THEN RETURN
  2570.       back=0
  2571.       IF temp='R' THEN
  2572.         back=getnumber('Set each conference pointer back how many messages?')
  2573.       SAY 'Resetting...'lineup
  2574.       data.22=''
  2575.       DO i=1 TO level
  2576.         IF temp='F' THEN num=0
  2577.         ELSE IF temp='O' THEN num=-1
  2578.         ELSE
  2579.           DO
  2580.             num=countcheck('LastMessage'i 0)-back
  2581.             IF num<1 THEN num=0
  2582.           END
  2583.         data.22=data.22 num
  2584.       END
  2585.       CALL setdata()
  2586.       CALL sortconferences()
  2587.       CALL savedata(1)
  2588.       RETURN
  2589.     END
  2590. new=0
  2591. change=0
  2592. edata.=''
  2593. edname=name
  2594. DO i=0 TO data.0
  2595.   edata.i=data.i
  2596. END
  2597. num=1
  2598. DO WHILE num~='' | edname~=name
  2599.   IF num='' | LEFT(num,1)='Q' THEN
  2600.     DO
  2601.       IF change THEN
  2602.         DO
  2603.           CALL setdata()
  2604.           CALL saveData(1)
  2605.           change=0
  2606.         END
  2607.       IF new THEN
  2608.         DO
  2609.           data.=''
  2610.           DO i=0 TO edata.0
  2611.             data.i=edata.i
  2612.           END
  2613.           name=edname
  2614.           new=0
  2615.         END
  2616.       CALL setdata()
  2617.     END
  2618.   maxnum=10
  2619.   IF edata.20>sysoplevel THEN maxnum=20
  2620.   IF edata.20=99 THEN maxnum=27
  2621.   SAY bak2' 'name' 'def
  2622.   maxlines=21
  2623.   IF maxnum=10 THEN maxlines=20
  2624.   DO i=1 TO maxlines
  2625.     IF i=5 & name~=edname & edata.20<99 THEN ITERATE
  2626.     SAY RIGHT(i,2)||pen3 text.i||def':' data.i
  2627.   END
  2628.   IF edata.20>sysoplevel THEN
  2629.     DO
  2630.       line=LEFT(' ',50)
  2631.       IF name=edname THEN line=line'NEW = Change User.'
  2632.       line=pen3||line||def||lineup
  2633.       SAY line
  2634.     END
  2635.   num=getinput(1 0 'Select Line Number To Edit: ')
  2636.   IF num='NEW' & edata.20>sysoplevel & edname=name THEN    /* select a new user */
  2637.     DO
  2638.       new=1
  2639.       IF change THEN
  2640.         DO
  2641.           CALL setdata()
  2642.           CALL saveData(1)
  2643.         END
  2644.       change=0
  2645.       nufile=bbspath'Lists/NEW_USERS'
  2646.       IF EXISTS(nufile) THEN CALL showtext(nufile 0)
  2647.       savename=name
  2648.       name=getinput(1 0 'New User Name: 'def)
  2649.       name=SPACE(name,1,'_')
  2650.       name=COMPRESS(name,':/*#?^')
  2651.       IF loaddata()=0 THEN name=savename
  2652.       IF data.20>=edata.20 THEN
  2653.         DO
  2654.           SAY 'Can''t Edit!' pen3||name def'has an equal or higher level than thee.'
  2655.           name=savename
  2656.           CALL loaddata()
  2657.         END
  2658.     END
  2659.   ELSE IF DATATYPE(num,'W') & num>0 THEN
  2660.     DO
  2661.       IF num>maxnum THEN
  2662.         DO
  2663.           SAY 
  2664.           SAY pen3'You are not authorized to change that information!'def
  2665.           SAY 
  2666.         END
  2667.       ELSE
  2668.         DO dummy=1 TO 1
  2669.           IF num=8 THEN
  2670.             DO
  2671.               SAY
  2672.               SAY 'Use spaces to seperate options.'
  2673.               SAY 'If the option word is in line 8, it is ON.'
  2674.               SAY 'Valid Options:'
  2675.               SAY '        CLEAR  clears screen between pages.'
  2676.               SAY '        COLOR  turns ANSI color codes ON.'
  2677.               SAY '        MENU   combines all main commands into 1 menu.'
  2678.               SAY '        MENUS  splits main commands into 3 menus.'
  2679.               SAY '        PHONE  makes your phone number public.'
  2680.               SAY '        QUICK  activates offline options. See bbsQUICK.DOC'
  2681.               SAY '        STREET makes your street address public.'
  2682.               SAY '        TERSE  skips some of the logon procedures.'
  2683.               SAY
  2684.             END
  2685.           line=RIGHT(num,2)||pen3 text.num||def': '
  2686.           SAY line||data.num
  2687.           temp=getinput(0 0 line)
  2688.           IF temp='' THEN
  2689.             DO
  2690.               IF num=1 | num=4 | num=5 | num=6 | num=7 THEN LEAVE dummy
  2691.               IF num=11 | num=12 | num=13 | num=20 THEN LEAVE dummy
  2692.             END
  2693.           IF num=5 | num=8 THEN temp=UPPER(temp)
  2694.           IF num=20 & DATATYPE(temp,'W') & temp>=edata.20 THEN
  2695.             temp=data.20
  2696.           IF edata.20>sysoplevel & name~=edname THEN line2=name' '
  2697.           ELSE line2=''
  2698.           IF num=21 & name=edname & edata.20<99 THEN LEAVE dummy
  2699.           line=text.num':' data.num pen6'CHANGED TO'def temp
  2700.           data.num=temp
  2701.           SAY line
  2702.           SAY 
  2703.           change=1
  2704.         END
  2705.     END
  2706. END
  2707. IF change THEN
  2708.   DO
  2709.     CALL setdata()
  2710.     CALL saveData(1)
  2711.   END
  2712. RETURN
  2713.  
  2714.  
  2715. setmsgs:
  2716. IF ~DATATYPE(bbsprefs.25,'W') THEN RETURN
  2717. data.22=''
  2718. data.23=''
  2719. SAY
  2720. line='Setting message counters to last'
  2721. IF bbsprefs.25>1 THEN line=line bbsprefs.25 'messages'
  2722. ELSE line=line 'message'
  2723. line=line 'in each conference...'
  2724. SAY line
  2725. DO i=1 TO level
  2726.   num=countcheck('LastMessage'i 0)-bbsprefs.25
  2727.   IF num<0 | msg.i.0<bbsprefs.25 THEN num=0
  2728.   lastread.i=num
  2729.   data.22=data.22 num
  2730.   data.23=data.23 0
  2731. END
  2732. SAY 'Setting file counter to last file uploaded...'
  2733. lastbrowse=countcheck('LastFile' 0)
  2734. newfilesdate=DATE('S') TIME()
  2735. RETURN
  2736.  
  2737.  
  2738. getnumber:
  2739. PARSE ARG tprompt
  2740. tnum=getinput(1 0 '  'tprompt' > ')
  2741. mask=COMPRESS(XRANGE(),'0123456789')
  2742. tnum=COMPRESS(tnum,mask)
  2743. IF ~DATATYPE(tnum,'W') THEN tnum=0
  2744. tnum=tnum%1
  2745. IF tnum>0 & tnum<10 THEN tnum='0'tnum
  2746. RETURN tnum
  2747.  
  2748.  
  2749. getbirth:
  2750. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  Birthday:'
  2751. SAY pen3'Birthday Information:'def
  2752. month=getnumber('Please enter the MONTH you were born: (1-12)')
  2753. day=getnumber('Please enter the DAY   you were born: (1-31)')
  2754. year=getnumber('Please enter the YEAR  you were born:       ')
  2755. IF year<100 THEN year=year+1900
  2756. born=year||month||day
  2757. IF born<18750101 | born>(DATE('S')-50000) THEN
  2758.   DO
  2759.     born=''
  2760.     IF getinput(1 1 'Would you rather skip this question? (Ny) > ')~='Y' THEN
  2761.       CALL getbirth()
  2762.   END
  2763. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  'WORD(data.12,3)' 'WORD(born,1)
  2764. RETURN
  2765.  
  2766.  
  2767. getname:
  2768. nonstop=0
  2769. CALL showuserlist()
  2770. SAY
  2771. waitchar='Q'
  2772. CALL showtext(bbspath'BBS_TEXT/NEW_USER_NAME' 1)
  2773. pline='Your name on'pen3 bbsname def'will be > '
  2774. name=getinput(1 0 pline)
  2775. name=cleanstring(1':'name)
  2776. IF name='' THEN
  2777.   DO
  2778.     SAY 'No name, no entry.  Bye!'
  2779.     SIGNAL DONE
  2780.   END
  2781. IF EXISTS(bbspath'Users/'name) | FIND(exclusion,name)>0 THEN
  2782.   DO
  2783.     SAY 'Sorry! That name is taken. Please try again.'
  2784.     RETURN 1
  2785.   END
  2786. IF getinput(1 1 'Your name on'pen3 bbsname def'will be >' name', is that correct? (nY) > ')='N' THEN
  2787.   RETURN 1
  2788. RETURN 0
  2789.  
  2790.  
  2791. /** see if name is in data */
  2792.  
  2793. checkUser:
  2794. tries=0
  2795. IF name='NEW' THEN
  2796.   DO
  2797.     name=''
  2798.     DO WHILE getname()
  2799.     END
  2800.   END
  2801. IF ~EXISTS(bbspath'Users/'name) THEN
  2802.   DO
  2803.     IF EXISTS(bbspath'BBS_TEXT/NEW') THEN
  2804.       DO
  2805.         nonstop=0
  2806.         CALL showtext(bbspath'BBS_TEXT/NEW' 1)
  2807.       END
  2808.     SAY
  2809.     defile=bbspath'BBS_TEXT/DEF.NEW_USER'
  2810.     CALL loadcourtesy()
  2811.     wordnum=FIND(courtesy,name)
  2812.     IF wordnum>0 THEN
  2813.       DO
  2814.         SAY name', is on the Courtesy List. You will be granted immediate access.'
  2815.         courtesy=STRIP(DELWORD(courtesy,wordnum,1))
  2816.         IF writeopen(bbspath'Lists/Courtesy') THEN
  2817.           DO
  2818.             DO i=1 TO WORDS(courtesy)
  2819.               CALL WRITELN(f,WORD(courtesy,i))
  2820.             END
  2821.             CALL CLOSE(f)
  2822.           END
  2823.         defile=bbspath'BBS_TEXT/DEF.COURTESY'
  2824.       END
  2825.     ELSE IF bbsprefs.7=0 THEN SAY name', You have new user access.'
  2826.     IF readlines(defile 1) THEN SIGNAL DONE
  2827.     data.=''
  2828.     data.0=27
  2829.     DO i=6 TO 22
  2830.       data.i=lynes.i
  2831.     END
  2832.     data.12=DATE('S')'  'TIME('C')
  2833.     data.13=data.12
  2834.     lastondate=DATE('I')-1
  2835.     lastontime=TIME('C')
  2836.     DO i=60 TO 2 BY -1
  2837.       SAY RIGHT('- 'i' -',14)
  2838.     END
  2839.     data.7=getinput(1 0 'What number is now at the top of your screen? > ')
  2840.     IF data.7<17 | data.7>75 THEN data.7=20
  2841.     SAY 'Please enter the password you would like to use here.'
  2842.     data.5=getinput(1 0 'Enter Password: ')
  2843.     DO WHILE getinput(1 1 'Your password on' bbsname 'will be :' data.5 ', is that correct? (nY) > ')='N'
  2844.       data.5=getinput(1 0 'Enter Password: ')
  2845.     END
  2846.     IF data.5='' THEN
  2847.       DO
  2848.         line=name 'refused to enter a password.'
  2849.         SIGNAL DONE
  2850.       END
  2851.     data.1=''
  2852.     DO WHILE data.1=''
  2853.       data.1=getinput(0 0 'Full (real) Name: ')
  2854.       IF data.1='' THEN SAY 'You MUST leave your real name!'
  2855.     END
  2856.     data.2=getinput(0 0 'Street: ')
  2857.     data.3=getinput(0 0 'City, State Zip: ')
  2858.     data.4=''
  2859.     DO WHILE data.4=''
  2860.       data.4=getinput(0 0 'Voice Phone (including areacode): ')
  2861.       IF data.4='' THEN
  2862.         SAY sysop 'MUST be able to reach you by phone to validate you!'
  2863.     END
  2864.     CALL getbirth()
  2865.     IF bbsprefs.8 THEN
  2866.       DO
  2867.         newufile=bbspath'Lists/NEW_USERS'
  2868.         IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  2869.         ELSE
  2870.           DO
  2871.             ok=OPEN(f,newufile,'W')
  2872.             IF ok~=0 THEN CALL WRITELN(f,'*** New Users ***')
  2873.           END
  2874.         IF ok~=0 THEN
  2875.           DO
  2876.             temp=RIGHT(TIME('C'),7) COMPRESS(DATE())
  2877.             temp=temp LEFT(name,24)'=' data.1'  'data.4
  2878.             CALL WRITELN(f,temp) 
  2879.           END
  2880.         CALL CLOSE(f)
  2881.       END
  2882.     data.9=getinput(0 0 'Computer: ')
  2883.     data.10=getinput(0 0 'Interests: ')
  2884.     test=getinput(1 1 pen3'Do you want other users to see your STREET address? (Ny) > 'def)
  2885.     IF test='Y' THEN data.8=data.8 'STREET'
  2886.     test=getinput(1 1 pen3'Do you want other users to see your PHONE number? (Ny) > 'def)
  2887.     IF test='Y' THEN data.8=data.8 'PHONE'
  2888.     IF bbsprefs.7>0 THEN
  2889.       DO
  2890.         data.20=bbsprefs.7
  2891.         CALL do_eleven(60 bbsprefs.16 bbsprefs.16-1)
  2892.       END
  2893.     SAY
  2894.     CALL setdata()
  2895.     IF data.20=0 THEN
  2896.       SAY 'Thank you, the sysop will give you higher access soon.'
  2897.     ELSE CALL setmsgs()
  2898.     SAY
  2899.     SAY 'Please feel free to leave additional info by using [C]omment.'
  2900.     SAY
  2901.     CALL saveData(1)
  2902.     SAY 'Adding' name 'to the user list...'
  2903.     newpassword=data.5
  2904.     sortuserflag=1
  2905.     temp=countcheck('Users' 0)+1
  2906.     CALL countcheck('Users' temp)
  2907.     CALL DELETE(bbspath'Lists/USERS')
  2908.   END
  2909. ELSE
  2910.   DO
  2911.     IF loaddata()=0 THEN SIGNAL DONE
  2912.     city=docity(data.3)
  2913.     PARSE VAR data.11 amins . . . ttimes . . . atimes .
  2914.     lastondate=DATE('I',WORD(data.13,1),'S')
  2915.     lastontime=WORD(data.13,2)
  2916.     IF DATE('I')>lastondate | level>=sysoplevel THEN atimes=ttimes
  2917.     IF level=99 THEN amins=120
  2918.     data.13=DATE('S')'  'TIME()
  2919.     CALL do_eleven(amins ttimes atimes-1)
  2920.     passprompt='Enter Password: '
  2921.     DO tries=1 TO 3
  2922.       OPTIONS PROMPT passprompt
  2923.       PULL newpassword
  2924.       SAY ''
  2925.       IF(password=newpassword) THEN LEAVE tries; /* correct password */
  2926.       IF tries=3 THEN
  2927.         DO
  2928.           SAY 
  2929.           SAY 'Access terminated.'
  2930.           line='*** Bad password ***' newpassword '***'
  2931.           SAY line
  2932.           SIGNAL OUT2
  2933.         END
  2934.       SAY lineup'                                 '
  2935.       passprompt='Incorrect.  Password: ' /* ask again */
  2936.     END
  2937.   END
  2938. CALL DELAY(14)
  2939. SAY 
  2940. RETURN
  2941.  
  2942.  
  2943. do_eleven:
  2944. ARG am tc at .
  2945. data.11=am 'minutes per call,' tc 'calls per day,'
  2946. data.11=data.11 at 'more calls today'
  2947. RETURN
  2948.  
  2949.  
  2950. saveData:
  2951. ARG messflag .
  2952. IF data.5='' THEN RETURN
  2953. SAY 'Updating...             'lineup
  2954. IF newfilesdate~='' THEN data.16=lastbrowse newfilesdate
  2955. ELSE IF lastbrowse>0 THEN
  2956.   DO
  2957.     IF WORDS(data.16)>1 THEN data.16=DELWORD(data.16,1,1)
  2958.     ELSE data.16=DATE('S') TIME()
  2959.     data.16=lastbrowse data.16
  2960.   END
  2961. IF messflag THEN
  2962.   DO
  2963.     userexclude.=0
  2964.     DO si=1 TO WORDS(data.22)
  2965.       IF WORD(data.22,si)=-1 THEN userexclude.si=1
  2966.     END
  2967.     data.22=''
  2968.     data.23=''
  2969.     DO si=1 TO level
  2970.       IF ~DATATYPE(lastread.si,'W') THEN lastread.si=0
  2971.       IF userexclude.si THEN data.22=data.22 '-1'
  2972.       ELSE data.22=data.22 lastread.si
  2973.       IF ~DATATYPE(totwrit.si,'W') THEN totwrit.si=0
  2974.       data.23=data.23 totwrit.si
  2975.     END
  2976.   END
  2977. IF writeopen(bbspath'USERS/'name)=0 THEN RETURN
  2978. IF data.0<27 THEN data.0=27
  2979. DO i=1 TO data.0
  2980.   CALL WRITELN(f,data.i)
  2981. END
  2982. CALL CLOSE(f)
  2983. SAY 'User' name 'has been updated.'
  2984. RETURN
  2985.  
  2986.  
  2987. loaddata:
  2988. IF name='' THEN RETURN 0
  2989. IF ~readopen(bbspath'USERS/'name) THEN RETURN 0
  2990. data.=''
  2991. DO i=1
  2992.   line=READLN(f)
  2993.   IF EOF(f) THEN BREAK
  2994.   data.i=line
  2995. END
  2996. data.0=i-1
  2997. CALL CLOSE(f)
  2998. winnings=WORD(data.18,1)
  2999. IF ~DATATYPE(winnings,'N') THEN winnings=0
  3000.  
  3001. setdata:
  3002. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  3003. lastbrowse=WORD(data.16,1)
  3004. IF ~DATATYPE(lastbrowse,'W') THEN lastbrowse=0
  3005. level=data.20
  3006. DO i=1 TO level
  3007.   lastread.i=WORD(data.22,i)
  3008.   IF ~DATATYPE(lastread.i,'W') THEN lastread.i=0
  3009.   totwrit.i=WORD(data.23,i)
  3010.   IF ~DATATYPE(totwrit.i,'W') THEN totwrit.i=0
  3011. END
  3012. password=data.5
  3013. IF ~DATATYPE(data.7,'W') THEN data.7=20
  3014. IF data.7<5 THEN data.7=5
  3015. IF FIND(UPPER(data.8),'TERSE')>0 THEN terseflag=1
  3016. ELSE terseflag=0
  3017. IF FIND(UPPER(data.8),'COLOR')>0 THEN colorflag=1
  3018. ELSE colorflag=0
  3019. CALL colors(colorflag)
  3020. IF FIND(UPPER(data.8),'CLEAR')>0 THEN clr='0C'x
  3021. ELSE clr=''
  3022. menu='ALL'
  3023. IF FIND(UPPER(data.8),'MENUS')>0 THEN
  3024.   DO
  3025.     menuflag=1
  3026.     menu='MAIN'
  3027.   END
  3028. ELSE IF FIND(UPPER(data.8),'MENU')>0 THEN menuflag=1
  3029. ELSE menuflag=0
  3030. IF level=0 THEN menu='NEW'
  3031. IF DATATYPE(WORD(data.11,3),'W') THEN
  3032.   DO
  3033.     PARSE VAR data.11 amins . atimes .
  3034.     CALL do_eleven(amins bbsprefs.16 atimes)
  3035.   END
  3036. data.21=UPPER(data.21)
  3037. CALL MAKEDIR(bbspath'Friends')
  3038. alias.=''
  3039. alias.0=0
  3040. realname.=''
  3041. CALL CLOSE(f)
  3042. IF OPEN(f,bbspath'Friends/'name,'R')=0 THEN RETURN 1
  3043. DO i=1
  3044.   line=READLN(f)
  3045.   IF EOF(f) THEN LEAVE i
  3046.   alias.i=WORD(line,1)
  3047.   realname.i=WORD(line,2)
  3048. END
  3049. alias.0=i-1
  3050. CALL CLOSE(f)
  3051. RETURN 1
  3052.  
  3053.  
  3054. switchmenuflag:
  3055. IF menuflag=1 THEN
  3056.   DO
  3057.     menuflag=0
  3058.     noff='OFF'
  3059.   END
  3060. ELSE
  3061.   DO
  3062.     menuflag=1
  3063.     noff='ON'
  3064.   END
  3065. SAY 'Menus turned' pen3||noff||def'.'
  3066. SAY 'To make a permanent change, add or delete MENU(S) from [Y]our userdata item 8.'
  3067. RETURN
  3068.  
  3069.  
  3070. switchcolors:
  3071. IF colorflag=1 THEN
  3072.   DO
  3073.     colorflag=0
  3074.     noff='OFF'
  3075.   END
  3076. ELSE
  3077.   DO
  3078.     colorflag=1
  3079.     noff='ON'
  3080.   END
  3081. CALL colors(colorflag)
  3082. SAY 'Color turned' pen3||noff||def'.'
  3083. SAY 'To make a permanent change, add or delete COLOR from [Y]our userdata item 8.'
  3084. RETURN
  3085.  
  3086.  
  3087. /* ANSI pen color codes */
  3088. colors:
  3089. ARG onoff
  3090. IF onoff THEN
  3091.   DO
  3092.     def='';  /* default */
  3093.     pen0='';  pen1='';  pen2='';  pen3=''
  3094.     pen4='';  pen5='';  pen6='';  pen7=''
  3095.     bak0='';  bak1='';  bak2='';  bak3=''
  3096.     bak4='';  bak5='';  bak6='';  bak7=''
  3097.   END
  3098. ELSE
  3099.   DO
  3100.     pen0=''; pen1=''; pen2=''; pen3=''; pen4=''; pen5=''; pen6=''; pen7=''
  3101.     bak0=''; bak1=''; bak2=''; bak3=''; bak4=''; bak5=''; bak6=''; bak7=''
  3102.     def='';
  3103.   END
  3104. RETURN
  3105.  
  3106.  
  3107. sortinfofiles:
  3108. infolist=SHOWDIR(bbspath'Information')
  3109. IF infolist='' THEN
  3110.   DO
  3111.     SAY 
  3112.     SAY pen3'No files are currently in the Information drawer.'def
  3113.     SAY 
  3114.     RETURN 1
  3115.   END
  3116. IF ~DATATYPE(sortinfo.0,'W') THEN
  3117.   DO
  3118.     info.=''
  3119.     sortinfo.=''
  3120.     info.0=WORDS(infolist)
  3121.     DO i=1 TO info.0
  3122.       info.i=WORD(infolist,i)
  3123.     END
  3124.     SAY 'Sorting..'
  3125.     IF info.0>0 THEN CALL QSORT(1,info.0,info)
  3126.     sortinfo.0=info.0%3
  3127.     IF (info.0//3)>0 THEN sortinfo.0=sortinfo.0+1
  3128.     DO i=1 TO sortinfo.0
  3129.       sortinfo.i=''
  3130.       DO j=0 TO 2
  3131.         k=i+j*sortinfo.0
  3132.         IF k<=info.0 THEN
  3133.           DO
  3134.             sortinfo.i=sortinfo.i RIGHT(k,3)'.' LEFT(info.k,19)
  3135.             infocount=WORD(STATEF(bbspath'Information/'info.k),8)
  3136.             sortinfo.i.0=sortinfo.i.0||RIGHT(infocount,5) LEFT(info.k,19)
  3137.           END
  3138.       END
  3139.     END
  3140.     SAY lineup'         'lineup
  3141.   END
  3142. RETURN 0
  3143.  
  3144.  
  3145. information:
  3146. IF sortinfofiles() THEN RETURN
  3147. SAY pen3'These text files are available for reading online...'def
  3148. num=1
  3149. readcount=-1
  3150. DO infoloop=1
  3151.   IF num=0 THEN
  3152.     DO
  3153.       IF readcount~=-1 THEN
  3154.         DO
  3155.           sortinfo.0=''
  3156.           IF sortinfofiles() THEN RETURN
  3157.         END
  3158.       SAY CENTER('- Number of accesses per file -',75)
  3159.     END
  3160.   SAY pen3||LEFT('-',75,'-')||def
  3161.   DO i=1 TO sortinfo.0
  3162.     IF num=0 THEN SAY sortinfo.i.0
  3163.     ELSE SAY sortinfo.i
  3164.   END
  3165.   SAY pen3||LEFT('-',75,'-')||def
  3166.   IF num=0 THEN
  3167.     DO
  3168.       CALL waiting()
  3169.       num=1
  3170.       ITERATE infoloop
  3171.     END
  3172.   num=getinput(1 0 pen3'Select Number Of Information File To View. 0=Stats > 'def)
  3173.   IF num=0 THEN ITERATE infoloop
  3174.   IF ~DATATYPE(num,'W') | num<1 | num>info.0 THEN RETURN
  3175.   readcount=STATEF(bbspath'Information/'info.num)
  3176.   readbytes=WORD(readcount,2)
  3177.   SAY '  'info.num 'is' readbytes 'bytes.'
  3178.   SAY 'Loading File...'
  3179.   CALL Increment.rexx(bbspath'Information/'info.num)
  3180.   CALL readlines(bbspath'Information/'info.num 1)
  3181.   CALL cleanline(0)
  3182.   SAY '    'lynes.0 'lines.'
  3183.   CALL seelines(0)
  3184.   IF waitchar~='Q' THEN CALL waiting()
  3185.   nonstop=0
  3186. END
  3187. RETURN
  3188.  
  3189.  
  3190. newfiles:
  3191. SAY 
  3192. test=getinput(1 1 'Show one library only? (Ny) > ')
  3193. IF test='Y' THEN
  3194.   IF chdir()>0 THEN RETURN
  3195. SAY 'Searching for new (un-browsed) files since' DATE(,WORD(data.16,2),'S') 'at' WORD(data.16,3)'...'
  3196. lastbrowz=WORD(data.16,1)
  3197. lastfile=countcheck('LastFile' 0)
  3198.  
  3199. newfiles2:
  3200. IF lastbrowz>=lastfile THEN
  3201.   DO
  3202.     lastbrowz=0
  3203.     SAY pen3'No new files. Listing backwards by date from last file uploaded...'def
  3204.   END
  3205. ELSE newfilesflag=1
  3206. j=0
  3207. IF test='Y' THEN
  3208.   DO
  3209.     filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))-1
  3210.     CALL busywait(4 1)
  3211.   END
  3212. DO ni=lastfile TO lastbrowz+1 BY -1
  3213.   IF files.ni~='' THEN
  3214.     DO
  3215.       IF test='Y' THEN 
  3216.         DO
  3217.           IF ni>1 THEN CALL busywait(60 ni lastfile-lastbrowz)
  3218.           IF j>=filecount THEN LEAVE ni
  3219.           IF UPPER(LEFT(WORD(files.ni,1),12))~=UPPER(LEFT(plaindir,12)) THEN
  3220.             ITERATE ni
  3221.         END
  3222.       jj=files.ni.0
  3223.       IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(WORD(files.ni,1)))>0 THEN
  3224.         ITERATE ni  /* unauthorized */
  3225.       IF test='Y' THEN CALL busywait(4 0)
  3226.       j=j+1
  3227.       IF j=1 THEN CALL fileheader()
  3228.       SAY LEFT(alpha.jj,76)
  3229.       IF (j+2)//(linesperpage-1)=0 THEN
  3230.         IF waiting2() THEN LEAVE ni
  3231.       IF test='Y' THEN CALL busywait(4 1)
  3232.     END
  3233. END
  3234. IF test='Y' THEN CALL busywait(4 0)
  3235. IF j//linesperpage~=0 THEN CALL waiting()
  3236. IF j=0 & newfilesflag=1 THEN
  3237.   DO
  3238.     lastbrowz=999999
  3239.     newfilesflag=0
  3240.     CALL newfiles2()
  3241.   END
  3242. IF test~='Y' THEN
  3243.   DO
  3244.     CALL newinfo()
  3245.     IF lynes.0>0 THEN CALL waiting()
  3246.   END
  3247. nonstop=0
  3248. RETURN
  3249.  
  3250.  
  3251. newinfo:
  3252. lynes.=''
  3253. lynes.0=0
  3254. dm=DATE(,WORD(data.16,2),'S')
  3255. PARSE VAR dm da' 'mo' 'yr .
  3256. yr=RIGHT(yr,2)
  3257. sincedate=da'-'mo'-'yr
  3258. startline=1
  3259. arg=bbspath'Information'
  3260. IF WORD(STATEF(arg),5)>lastondate THEN
  3261.   DO
  3262.     ADDRESS COMMAND 'C:LIST >'scratch'/locdirlist' arg 'NOHEAD DATES SINCE' sincedate
  3263.     IF WORD(STATEF(scratch'/locdirlist'),2)>3 THEN
  3264.       DO
  3265.         lynes.startline=pen1||bak2' New or Updated Information Files. Enter'def pen3'I'def bak2'from the main menu to read 'def
  3266.         CALL readlines(scratch'/locdirlist' startline+1)
  3267.       END
  3268.   END
  3269. arg=bbspath'Profiles'
  3270. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  3271.   DO
  3272.     ADDRESS COMMAND 'C:LIST >'scratch'/locdirlist' arg 'NOHEAD DATES SINCE' sincedate
  3273.     IF WORD(STATEF(scratch'/locdirlist'),2)>3 THEN
  3274.       DO
  3275.         startline=lynes.0+2
  3276.         lynes.startline=pen1||bak2' New or Updated User Profiles. Enter'def pen3'&'def bak2'from the main menu to read 'def
  3277.         CALL readlines(scratch'/locdirlist' startline+1)
  3278.       END
  3279.   END
  3280. arg=bbspath'rexxDoors/Data/Polls'
  3281. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  3282.   DO
  3283.     startline=lynes.0+2
  3284.     lynes.startline=pen1||bak2' Voting Activity. Enter'def pen3'J'def bak2'from the main menu, then select Polling_Place 'def
  3285.     lynes.0=startline
  3286.   END
  3287. IF logonflag=1 THEN nonstop=1
  3288. IF lynes.0>0 THEN CALL seelines(1)
  3289. nonstop=0
  3290. RETURN
  3291.  
  3292.  
  3293. chdir:
  3294. string=''
  3295. SAY pen3||LEFT('-',75,'-')||def
  3296. DO i=1 TO libs.0
  3297.   SAY libs.i
  3298. END
  3299. SAY pen3||LEFT('-',75,'-')||def
  3300. dirnum=getinput(1 0 pen3'Select Library Number: 'def)
  3301. IF clr~='' THEN SAY clr
  3302. IF ~DATATYPE(dirnum,'W') THEN
  3303.   DO
  3304.     waitchar=dirnum
  3305.     RETURN 2
  3306.   END
  3307.  
  3308. chdir2:
  3309. IF dirnum<1 | dirnum>99 THEN
  3310.   DO
  3311.     waitchar=dirnum
  3312.     RETURN 1
  3313.   END
  3314. IF dirs.dirnum='' THEN
  3315.   DO
  3316.     SAY pen3'That library number is currently un-assigned.'def
  3317.     RETURN 1
  3318.   END
  3319. IF dirnum>level | FIND(data.21,UPPER(dirs.dirnum))>0 THEN
  3320.   DO
  3321.     SAY pen3'You do not have authorization for that library!'def
  3322.     RETURN 1
  3323.   END
  3324. td=libpath||dirs.dirnum
  3325. CALL MAKEDIR(td)
  3326. CALL setdir(td)
  3327. IF libtext=0 THEN
  3328.   IF EXISTS(td'/.'STRIP(LEFT(dirs.dirnum,15))) THEN RETURN 0
  3329. t=libpath||plaindir'.txt'
  3330. IF terseflag | ~EXISTS(t) THEN RETURN 0
  3331. nonstop=1
  3332. SAY
  3333. CALL showtext(t 0)
  3334. SAY
  3335. RETURN 0
  3336.  
  3337.  
  3338. since:
  3339. dm=DATE(,WORD(data.16,2),'S')
  3340. SAY 
  3341. SAY 'New files or files moved since' dm
  3342. CALL listsince()
  3343. CALL showtext(scratch'/locdirlist' 1)
  3344. RETURN
  3345.  
  3346.  
  3347. listsince:
  3348. dm=DATE(,WORD(data.16,2),'S')
  3349. PARSE VAR dm da' 'mo' 'yr .
  3350. yr=RIGHT(yr,2)
  3351. sincedate=da'-'mo'-'yr
  3352. ADDRESS COMMAND 'C:list >'scratch'/locdirlist' directory 'DATES SINCE' sincedate
  3353. RETURN
  3354.  
  3355.  
  3356. list:
  3357. onetime=0
  3358. IF DATATYPE(arg,'W') THEN onetime=1
  3359. ELSE arg=''
  3360. DO listloop=1
  3361.   IF DATATYPE(arg,'W') THEN
  3362.     DO
  3363.       dirnum=arg
  3364.       arg=''
  3365.       IF chdir2()>0 THEN RETURN
  3366.       CALL listsimple()
  3367.       IF waitchar='Q' | onetime THEN LEAVE listloop
  3368.     END
  3369.   ELSE IF arg='' THEN
  3370.     DO
  3371.       libtext=0
  3372.       IF chdir()>0 THEN
  3373.         DO
  3374.           libtext=1
  3375.           RETURN
  3376.         END
  3377.       test='Y'
  3378.       CALL showalpha2()
  3379.       arg=''
  3380.       IF waitchar='Q' THEN waitchar=''
  3381.       IF waitchar~='' THEN RETURN
  3382.       ITERATE listloop
  3383.     END
  3384.   ELSE RETURN
  3385. END
  3386. RETURN
  3387.  
  3388.  
  3389. listsimple:
  3390. ADDRESS COMMAND 'C:list >'scratch'/locdirlist' directory 'DATES'
  3391. IF readlines(scratch'/locdirlist' 1) THEN RETURN
  3392. IF lynes.0>3 THEN
  3393.   DO
  3394.     SAY pen3'Sorting...'def||lineup
  3395.     linesave=lynes.1  /* these 4 lines put in to leave dir title at top */
  3396.     lynes.1='0'
  3397.     IF lynes.0>1 THEN CALL QSORT(1,lynes.0-1,lynes)
  3398.     CALL DELAY(14)
  3399.     lynes.1=linesave
  3400.   END
  3401. CALL seelines(1)
  3402. nonstop=0
  3403. CALL waiting()
  3404. RETURN
  3405.  
  3406.  
  3407. browse:
  3408. curdironly=0
  3409. brdir=PRAGMA('D')
  3410. brfilenum=1
  3411. nonstop=0
  3412. IF files.0<1 THEN RETURN
  3413. lastfile=countcheck('LastFile' 0)
  3414. IF lastfile<1 THEN RETURN
  3415. onearg=0
  3416. IF arg='' THEN
  3417.   DO
  3418.     lin='Browsing'
  3419.     test=getinput(1 1 'Browse one library only? (Ny) > ')
  3420.     IF test='Y' THEN
  3421.       DO
  3422.         IF chdir()>0 THEN RETURN
  3423.         curdironly=1
  3424.         lin=lin 'the' pen3||plaindir||def 'library'
  3425.         t=libpath||plaindir'.txt'
  3426.         IF edinfo(t,plaindir,'File Library') THEN RETURN
  3427.       END
  3428.     ELSE lin=lin 'all file libraries'
  3429.     lin=lin 'backwards from latest file.'
  3430.     SAY lin
  3431.     SAY
  3432.   END
  3433. ELSE onearg=1
  3434. i=0
  3435. IF arg='' | UPPER(arg)='NEW' | UPPER(arg)='ALL' THEN
  3436.   DO lastfileloop=1
  3437.     IF lastfile<1 THEN RETURN
  3438.     arg=WORD(files.lastfile,2)
  3439.     brfilenum=lastfile
  3440.     IF WORD(files.lastfile,2)~='' THEN LEAVE lastfileloop
  3441.     lastfile=lastfile-1
  3442.   END
  3443. ELSE IF DATATYPE(arg,'W') THEN
  3444.   DO
  3445.     brfilenum=arg
  3446.     arg=WORD(files.arg,2)
  3447.     IF arg='' THEN
  3448.       DO
  3449.         SAY 'File number' brfilenum 'does not exist in the current libraries!'
  3450.         RETURN
  3451.       END
  3452.   END
  3453. ELSE
  3454.   DO
  3455.     IF onearg THEN CALL busywait(4 1)
  3456.     DO ni=lastfile TO 1 BY -1
  3457.       IF onearg THEN CALL busywait(60 ni lastfile)
  3458.       IF UPPER(WORD(files.ni,2))~=UPPER(arg) THEN ITERATE ni
  3459.       brfilenum=ni
  3460.       CALL busywait(4 0)
  3461.       LEAVE ni
  3462.     END
  3463.     IF ni<1 THEN
  3464.       DO
  3465.         SAY 'Unable to find a file description for' pen3||arg||def'.'
  3466.         RETURN
  3467.       END
  3468.   END
  3469. IF ~curdironly THEN CALL setdir(libpath||WORD(files.brfilenum,1))
  3470. savearg=arg
  3471. IF brfilenum>lastfile THEN brfilenum=lastfile
  3472. newfilesdate=DATE('S') TIME()
  3473. DO browseloop=1
  3474.   IF curdironly THEN CALL busywait(4 1)
  3475.   DO ni=brfilenum TO 0 BY -1
  3476.     IF ni=0 THEN LEAVE browseloop
  3477.     IF files.ni='' THEN ITERATE ni
  3478.     IF onearg THEN
  3479.       DO
  3480.         CALL busywait(60 ni lastfile)
  3481.         IF UPPER(arg)~=UPPER(WORD(files.ni,2)) THEN ITERATE ni
  3482.         IF (ni//30)>0 THEN CALL busywait(4 1)
  3483.         LEAVE ni
  3484.       END
  3485.     testdir=UPPER(WORD(files.ni,1))
  3486.     IF curdironly & UPPER(plaindir)~=UPPER(testdir) THEN
  3487.       DO
  3488.         IF ni>lastbrowse THEN lastbrowse=ni
  3489.         IF ni>0 THEN CALL busywait(60 ni lastfile)
  3490.         ITERATE ni
  3491.       END
  3492.     IF FIND(data.21,testdir)>0 | finddirnum(testdir)>level THEN
  3493.       DO
  3494.         IF ni>lastbrowse THEN lastbrowse=ni
  3495.         ITERATE ni
  3496.       END
  3497.     LEAVE ni
  3498.   END
  3499.   IF curdironly | onearg THEN CALL busywait(4 0)
  3500.   onearg=0
  3501.   IF ni=0 THEN brfilenum=lastbrowse
  3502.   ELSE brfilenum=ni
  3503.   argname=WORD(files.brfilenum,2)
  3504.   IF argname='' THEN RETURN
  3505.   CALL setdir(libpath||WORD(files.brfilenum,1))
  3506.   arg=bbspath'FileNotes/'plaindir'/'argname
  3507.   CALL readlines(arg 1)
  3508.   IF nonstop=1 THEN brostop=1
  3509.   ELSE brostop=0
  3510.   CALL seelines(1)
  3511.   IF brfilenum>lastbrowse THEN lastbrowse=brfilenum
  3512.   IF brostop THEN
  3513.     DO
  3514.       SAY
  3515.       nonstop=1
  3516.       brfilenum=brfilenum-1
  3517.     END
  3518.   ELSE
  3519.     DO
  3520.       line=''
  3521.       endtest=UPPER(RIGHT(argname,4))
  3522.       IF FIND('.ARC .ARJ .DMS .LZH .LHA .RUN .ZIP .ZOO',endtest)>0 THEN
  3523.         line='['pen3'C'def']ontents ['pen3'D'def']ownload'
  3524.       ELSE line='['pen3'D'def']ownload'
  3525.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3526.         line=line '['pen3'E'def']dit'
  3527.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3528.         line=line '['pen3'K'def']ill'
  3529.       IF level>sysoplevel THEN line=line '['pen3'L'def']ib'
  3530.       line=line '['pen3'M'def']ark ['pen3'N'def']on-Stop'
  3531.       IF endtest='.TXT' | UPPER(argname)='.'UPPER(STRIP(LEFT(plaindir,15))) THEN
  3532.         line=line '['pen3'R'def']ead'
  3533.       line=line '['pen3'Q'def']uit ['pen3'?'def'] > '
  3534.       brcom=getinput(1 0 line)
  3535.       IF DATATYPE(brcom,'W') THEN
  3536.         DO
  3537.           brfilenum=brcom+1
  3538.           IF brfilenum>lastfile THEN brfilenum=lastfile+1
  3539.           IF brfilenum<1 THEN brfilenum=1
  3540.           SAY
  3541.         END
  3542.       ELSE brcom=LEFT(brcom,1)
  3543.       CALL cleanline(0)
  3544.       IF brcom='Q' THEN LEAVE browseloop
  3545.       IF brcom='M' THEN
  3546.         DO
  3547.           wordnum=FIND(data.25,brfilenum)
  3548.           IF wordnum=0 THEN
  3549.             DO
  3550.               data.25=STRIP(data.25 brfilenum)
  3551.               SAY lineup||argname 'marked for next download.'
  3552.               SAY
  3553.             END
  3554.           ELSE
  3555.             DO
  3556.               data.25=STRIP(DELWORD(data.25,wordnum,1))
  3557.               SAY argname 'removed from download list.'
  3558.             END
  3559.         END
  3560.       IF brcom='H' | brcom='?' THEN
  3561.         DO
  3562.           SAY pen3' - HELP with the Browse Files commands -'def
  3563.           SAY ' RETURN reads the next file description in line.'
  3564.           SAY ' 34 will display the description of file number 34, if it exists.'
  3565.           SAY ' C  displays the contents of an archived (arc dms lzh lha zip zoo) file.'
  3566.           SAY ' D  displays the download menu.'
  3567.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3568.             DO
  3569.           SAY ' E  puts this file description into the online Editor.'
  3570.           SAY ' K  deletes a file you uploaded. you cannot Kill others!'
  3571.             END
  3572.           IF level>sysoplevel THEN
  3573.           SAY ' L  move file and description to new Library and/or rename.'
  3574.           SAY ' M  mark/unmark the current file for the next download'
  3575.           SAY ' N  displays all descriptions without pausing. CTRL-E to Exit!'
  3576.           SAY ' R  displays file as text. - ONLY FILES THAT END IN .TXT -'
  3577.           SAY ' Q  returns to the main menu(s). (Quit)'
  3578.           SAY
  3579.           CALL waiting()
  3580.           IF waitchar='Q' THEN LEAVE browseloop
  3581.         END
  3582.       ELSE IF brcom='L' & level>sysoplevel THEN
  3583.         DO
  3584.           curdir=PRAGMA('D')
  3585.           IF getinput(1 1 'Rename' argname '? (Ny) > ')='Y' THEN
  3586.             DO
  3587.               newarg=getinput(0 0 'Rename' argname 'to ')
  3588.               IF newarg~='' THEN
  3589.                 DO
  3590.                   IF is_here(newarg) THEN ITERATE browseloop
  3591.                   IF wi=999999 THEN ITERATE browseloop
  3592.                   IF EXISTS(libpath||filedir'/'newarg) THEN
  3593.                     DO
  3594.                       SAY
  3595.                       SAY '***' newarg 'already exists!'
  3596.                       SAY
  3597.                       ITERATE browseloop
  3598.                     END
  3599.                   junk=getinput(1 1 'Are you SURE you want to rename' argname 'to' newarg'? (Ny) ')
  3600.                   IF junk='Y' THEN
  3601.                     DO
  3602.                       lynes.2=OVERLAY(newarg,lynes.2,7,25)
  3603.                       comment=WORD(STATEF(arg),8)
  3604.                       CALL DELETE(arg)
  3605.                       arg=bbspath'FileNotes/'plaindir'/'newarg
  3606.                       CALL savelines(arg)
  3607.                       IF comment='' THEN
  3608.                         DO
  3609.                           mpath=libpath||plaindir
  3610.                           IF RENAME(mpath'/'argname,mpath'/'newarg)=0 THEN
  3611.                             SAY 'Rename failed on main file!'
  3612.                         END
  3613.                       ELSE
  3614.                         DO
  3615.                           t=LASTPOS('/',comment)
  3616.                           IF t=0 THEN t=LASTPOS(':',comment)
  3617.                           mpath=LEFT(comment,t-1)
  3618.                           IF RENAME(comment,mpath'/'newarg)=1 THEN
  3619.                             ADDRESS COMMAND 'C:FileNote' arg mpath'/'newarg
  3620.                           ELSE SAY 'Rename failed on external file!'
  3621.                         END
  3622.                       files.brfilenum=STRIP(WORD(files.brfilenum,1)) newarg
  3623.                       anum=files.brfilenum.0
  3624.                       alpha.anum=OVERLAY(newarg,alpha.anum,1,WORDINDEX(alpha.anum,2)-2)
  3625.                       argname=newarg
  3626.                       sortalphaflag=1
  3627.                       savefileflag=1
  3628.                       CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  3629.                     END
  3630.                 END
  3631.             END
  3632.           mvdir=getinput(0 0 'Move' argname 'to Library (name|number) ')
  3633.           IF mvdir~='' THEN
  3634.             DO
  3635.               IF DATATYPE(mvdir,'W') THEN
  3636.                 DO
  3637.                   dirnum=mvdir
  3638.                   IF UPPER(dirs.dirnum)~=UPPER(WORD(files.brfilenum,1)) THEN
  3639.                     DO
  3640.                       IF chdir2()=0 THEN
  3641.                         DO
  3642.                           CALL readlines(arg 1)
  3643.                           CALL movefile(brfilenum dirs.dirnum)
  3644.                         END
  3645.                     END
  3646.                 END
  3647.               ELSE
  3648.                 DO
  3649.                   mvdir=STRIP(mvdir)
  3650.                   IF UPPER(mvdir)~=UPPER(WORD(files.brfilenum,1)) THEN
  3651.                     DO
  3652.                       DO mj=1 TO level+1
  3653.                         IF UPPER(mvdir)=UPPER(dirs.mj) THEN LEAVE mj
  3654.                       END
  3655.                       IF mj<=level THEN CALL movefile(brfilenum mvdir)
  3656.                     END
  3657.                 END
  3658.             END
  3659.           IF savefileflag>0 THEN CALL savefilelist()
  3660.           CALL setdir(curdir)
  3661.         END
  3662.       ELSE IF brcom='N' THEN
  3663.         DO
  3664.           brfilenum=brfilenum-1
  3665.           nonstop=1
  3666.           SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E'def
  3667.           SAY
  3668.           CALL DELAY(99)
  3669.           brcom=''
  3670.         END
  3671.       ELSE IF brcom='C' THEN
  3672.         DO
  3673.           temp=STRIP(WORD(STATEF(arg),8))
  3674.           IF temp='' THEN temp=libpath||plaindir'/'argname
  3675.           CALL Contents.rexx(temp)
  3676.           IF EXISTS('RAM:CONTENTS') THEN
  3677.             DO
  3678.               CALL showtext('RAM:CONTENTS' 0)
  3679.               IF waitchar~='Q' THEN CALL waiting()
  3680.               nonstop=0
  3681.             END
  3682.           ELSE SAY pen3'Not an archived file.'def
  3683.         END
  3684.       ELSE IF brcom='D' THEN
  3685.         DO
  3686.           arg2=arg
  3687.           arg=brfilenum
  3688.           CALL dload()
  3689.           arg=arg2
  3690.         END
  3691.       ELSE IF brcom='E' THEN
  3692.         DO
  3693.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3694.             DO
  3695.               firstedit=5
  3696.               IF level>sysoplevel THEN firstedit=1
  3697.               CALL bbsEd.rexx(firstedit arg name)
  3698.               CALL checkfilechanges()
  3699.             END
  3700.         END
  3701.       ELSE IF brcom='K' THEN
  3702.         DO
  3703.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  3704.             DO
  3705.               IF getinput(1 1 pen3'Do you really want to kill this file? (nY) >'def)~='N' THEN
  3706.                 DO
  3707.                   tempnum=WORD(lynes.1,2)
  3708.                   IF tempnum=lastfile THEN
  3709.                     DO
  3710.                       CALL DELETE(bbspath'Numbers/LastFile')
  3711.                       CALL DELAY(28)
  3712.                       lastfile=lastfile-1
  3713.                       CALL countcheck('LastFile' lastfile)
  3714.                     END
  3715.                   files.tempnum=''
  3716.                   tempnum2=files.tempnum.0
  3717.                   alpha.tempnum2='0 0' tempnum '100'
  3718.                   savefileflag=1
  3719.                   CALL savefilelist()
  3720.                   finfo=STATEF(arg)
  3721.                   IF WORDS(finfo)>7 THEN argname=WORD(finfo,8)
  3722.                   CALL DELETE(argname)
  3723.                   CALL DELETE(arg)
  3724.                   SAY argname pen3'has been deleted.'def
  3725.                   CALL DELETE(libpath||plaindir'/.'STRIP(LEFT(plaindir,15)))
  3726.                 END
  3727.             END
  3728.         END
  3729.       ELSE IF brcom='R' & (endtest='.TXT' | UPPER(argname)='.'UPPER(STRIP(LEFT(plaindir,15)))) THEN
  3730.         DO
  3731.           vcount=WORD(lynes.2,7)+1
  3732.           lynes.2=STRIP(DELWORD(lynes.2,7,1)) vcount
  3733.           edtype=''
  3734.           CALL savelines(arg)
  3735.           CALL showtext(argname 1)
  3736.         END
  3737.       ELSE brfilenum=brfilenum-1
  3738.     END
  3739. END
  3740. CALL setdir(brdir)
  3741. waitchar=''
  3742. IF nonstop THEN CALL waiting()
  3743. nonstop=0
  3744. CALL savedata(0)
  3745. RETURN
  3746.  
  3747.  
  3748. movefile:
  3749. PARSE ARG fnum movdir .
  3750. fromdir=STRIP(WORD(files.fnum,1))
  3751. farg=STRIP(WORD(files.fnum,2))
  3752. md=libpath||movdir
  3753. mf=md'/'farg
  3754. fd=libpath||fromdir
  3755. ff=fd'/'farg
  3756. CALL DELETE(md'/.'STRIP(LEFT(movdir,15)))
  3757. CALL DELETE(fd'/.'STRIP(LEFT(fromdir,15)))
  3758. fn=bbspath'FileNotes/'fromdir'/'farg
  3759. commen=WORD(STATEF(fn),8)
  3760. IF commen~='' THEN
  3761.   DO
  3762.     ff=commen
  3763.     n=LASTPOS('/',ff)
  3764.     IF n>1 THEN
  3765.       DO
  3766.         xf=SUBSTR(ff,n+1)
  3767.         tfd=LEFT(ff,n-1)
  3768.         n=LASTPOS('/',tfd)
  3769.         IF n=0 THEN n=LASTPOS(':',tfd)
  3770.         IF n>0 THEN
  3771.           DO
  3772.             tmd=LEFT(tfd,n)||movdir
  3773.             SAY 'Rename external file'pen3 ff||def
  3774.             IF getinput(1 1 '                  to'pen3 tmd'/'farg||def'? (Ny) > ')='Y' THEN
  3775.               DO
  3776.                 fd=tfd
  3777.                 md=tmd
  3778.                 mf=md'/'farg
  3779.                 commen=md'/'xf
  3780.               END
  3781.             ELSE IF getinput(1 1 '          or move to'pen3 mf||def'? (Ny) > ')='Y' THEN
  3782.               DO
  3783.                 fd=tfd
  3784.                 commen=''
  3785.               END
  3786.           END
  3787.       END
  3788.   END
  3789. CALL MAKEDIR(md)
  3790. IF RENAME(ff,mf)=0 THEN
  3791.   DO
  3792.     ADDRESS COMMAND 'C:COPY' ff mf
  3793.     IF EXISTS(mf) THEN
  3794.       IF DELETE(ff)~=1 THEN SAY pen3'Unable to delete'def ff||pen3'.'def
  3795.   END
  3796. files.fnum=movdir farg
  3797. lynes.3=DELWORD(lynes.3,WORDS(lynes.3),1)
  3798. lynes.3=STRIP(lynes.3) movdir
  3799. CALL MAKEDIR(bbspath'FileNotes/'movdir)
  3800. mn=bbspath'FileNotes/'movdir'/'farg
  3801. CALL savelines(mn)
  3802. ndx=files.fnum.0
  3803. dnum=finddirnum(movdir)
  3804. alpha.ndx=OVERLAY(RIGHT(dnum,2) movdir,alpha.ndx,31,15)
  3805. IF EXISTS(mn) THEN
  3806.   DO
  3807.     CALL DELETE(fn)
  3808.     IF commen~='' THEN ADDRESS COMMAND 'C:FileNote' mn commen
  3809.   END
  3810. savefileflag=1
  3811. line='Moved:' fromdir'/'farg 'to' movdir
  3812. SAY line
  3813. RETURN
  3814.  
  3815.  
  3816. textsearch:
  3817. ARG sfile' 'sarg
  3818. IF sarg='' THEN RETURN 0
  3819. x=OPEN(f,sfile,'R')
  3820. IF x=0 THEN RETURN 0
  3821. stemp=UPPER(READCH(f,65000))
  3822. CALL CLOSE(f)
  3823. retflag=0
  3824. IF POS(sarg,stemp)>0 THEN retflag=1
  3825. RETURN retflag
  3826.  
  3827.  
  3828. bbsSEARCH:
  3829. smenu=menu
  3830. test=UPPER(LEFT(arg,1))
  3831. IF test='F' THEN smenu='FILE'
  3832. IF test='M' THEN smenu='MSG'
  3833. IF test='U' THEN smenu='MAIN'
  3834. IF smenu='ALL' THEN
  3835.   DO
  3836.     junk=getinput(1 1 'Search ['pen3'F'def']iles ['pen3'M'def']essages or ['pen3'U'def']sers (fmu) > ')
  3837.     IF junk='F' THEN smenu='FILE'
  3838.     ELSE IF junk='M' THEN smenu='MSG'
  3839.     ELSE IF junk='U' THEN smenu='MAIN'
  3840.     ELSE RETURN
  3841.   END
  3842. IF WORDS(arg)>1 THEN searcharg=UPPER(SUBSTR(arg,WORDINDEX(arg,2)))
  3843. ELSE searcharg=getinput(0 0 pen3'Search Phrase: 'def)
  3844. IF LENGTH(STRIP(searcharg))=0 THEN RETURN
  3845. searcharg=COMPRESS(searcharg,'*')
  3846. IF smenu='NEW' | smenu='MAIN' THEN
  3847.   DO
  3848.     SAY 'Searching Userlist...'
  3849.     CALL FileList(bbspath'Users/*'searcharg'*',sl)
  3850.     SAY 'Found' sl.0 'matches                    '
  3851.     DO i=1 TO sl.0
  3852.       SAY sl.i
  3853.       IF ~nonstop THEN
  3854.         IF i//linesperpage=0 THEN
  3855.           IF waiting2() THEN LEAVE i
  3856.     END
  3857.     DROP sl.
  3858.   END
  3859. IF smenu='MSG' THEN
  3860.   DO
  3861.     CALL SETCLIP('BBSMSG_SEARCH',searcharg)
  3862.     SAY lm
  3863.     CALL bbsMsg.rexx(3000 name password) 
  3864.   END
  3865. IF smenu='FILE' THEN
  3866.   DO
  3867.     lne=pen3'Searching'
  3868.     curdironly=0
  3869.     IF getinput(1 1 'Search one library only? (Ny) > ')='Y' THEN
  3870.       DO
  3871.         IF chdir()>0 THEN RETURN
  3872.         curdironly=1
  3873.         lne=lne 'the'def plaindir pen3'library'
  3874.         SAY
  3875.       END
  3876.     ELSE
  3877.       DO
  3878.         lne=lne 'all file libraries'
  3879.         SAY
  3880.         SAY pen3'WARNING!'def 'Searching' RIGHT(files.0,5) '['pen3'F'def']ull descriptions may take'pen3 TRUNC(files.0/(114*cpu)+.05,1) def'minutes!'
  3881.       END
  3882.     test=getinput(1 1 '   ['pen3'A'def']lphaList search or ['pen3'F'def']ull descriptions? (Afq) > ')
  3883.     IF test='Q' THEN RETURN
  3884.     SAY
  3885.     SAY lne 'for'def UPPER(searcharg)
  3886.     SAY pen3' - To ABORT, press CTRL-E -'def
  3887.     SAY
  3888.     IF test~='F' THEN
  3889.       DO
  3890.         CALL fileheader()
  3891.         IF curdironly=1 THEN
  3892.           DO
  3893.             af=libpath||dirs.dirnum'/.'STRIP(LEFT(dirs.dirnum,15))
  3894.             IF EXISTS(af) THEN
  3895.               DO
  3896.                 CALL readlines(af 1)
  3897.                 DO i=1 TO lynes.0
  3898.                   CALL busywait(8 i lynes.0)
  3899.                   tempnum=POS(UPPER(searcharg),UPPER(lynes.i))
  3900.                   IF tempnum>0 THEN
  3901.                     DO
  3902.                       CALL busywait(4 0)
  3903.                       SAY lynes.i
  3904.                       SAY pen3||LEFT(' ',tempnum-1)||lineup||UPPER(searcharg)||def
  3905.                       CALL busywait(4 1)
  3906.                     END
  3907.                 END
  3908.               END
  3909.           END
  3910.         IF curdironly=0 | ~EXISTS(af) THEN
  3911.           DO i=1 TO alpha.0
  3912.             CALL busywait(60 i alpha.0)
  3913.             ii=WORD(alpha.i,4)
  3914.             IF ii>level THEN ITERATE i
  3915.             IF curdironly=1 & ii~=dirnum THEN ITERATE i
  3916.             ii=WORD(alpha.i,3)
  3917.             IF POS(UPPER(WORD(files.ii,1)),data.21)>0 THEN ITERATE i
  3918.             tempnum=POS(UPPER(searcharg),UPPER(alpha.i))
  3919.             IF tempnum>0 THEN
  3920.               DO
  3921.                 CALL busywait(4 0)
  3922.                 SAY alpha.i
  3923.                 SAY pen3||LEFT(' ',tempnum-1)||lineup||UPPER(searcharg)||def
  3924.                 CALL busywait(4 1)
  3925.               END
  3926.           END
  3927.       END
  3928.     ELSE
  3929.       DO
  3930.         cck=countcheck('LastFile' 0)
  3931.         nonstop=1
  3932.         DO i=1 TO cck
  3933.           iii=cck+1-i
  3934.           IF files.iii='' THEN ITERATE i
  3935.           ii=files.iii.0
  3936.           ii=WORD(alpha.ii,4)
  3937.           IF ii>level THEN ITERATE i
  3938.           IF curdironly=1 & ii~=dirnum THEN ITERATE i
  3939.           IF POS(UPPER(WORD(files.iii,1)),data.21)>0 THEN ITERATE i
  3940.           farg=WORD(files.iii,1)'/'WORD(files.iii,2)
  3941.           SAY '1B'x'M' RIGHT(farg,40) LEFT(iii,7)
  3942.           IF textsearch(bbspath'FileNotes/'farg searcharg) THEN
  3943.             DO
  3944.               savei=i
  3945.               CALL readlines(bbspath'FileNotes/'farg 1)
  3946.               nonstop=1
  3947.               CALL seelines(2)
  3948.               i=savei
  3949.               SAY
  3950.               SAY
  3951.             END
  3952.         END
  3953.       END
  3954.     CALL busywait(4 0)
  3955.   END
  3956. searcharg=''
  3957. nonstop=0
  3958. SAY
  3959. IF i<999999 THEN SAY 'All available items have been searched.'
  3960. SAY
  3961. CALL waiting()
  3962. RETURN
  3963.  
  3964.  
  3965. finddirnum:
  3966. ARG fdirname .
  3967. DO fdir=1 TO 99
  3968.   IF UPPER(dirs.fdir)=UPPER(fdirname) THEN RETURN fdir
  3969. END
  3970. RETURN 100
  3971.  
  3972.  
  3973. writebuffer:
  3974. PARSE ARG bufname .
  3975. CALL DELETE(bufname)
  3976. startnum=lynes.0+1
  3977. OPTIONS PROMPT ''
  3978. SAY pen3'LOCAL logon! Input cannot exceed 250 characters per line!'def
  3979. SAY 'Type 'pen3'/E'def 'or' pen3'/S'def' on a new line to exit and' pen3'DO YOUR OWN WORDWRAP!'def
  3980. DO bufloop=startnum
  3981.   PARSE PULL line
  3982.   IF LEFT(UPPER(STRIP(line)),2)='/E' | LEFT(UPPER(STRIP(line)),2)='/S' THEN
  3983.     LEAVE bufloop
  3984.   lynes.bufloop=line
  3985. END
  3986. lynes.0=bufloop-1
  3987. CALL wrapbuf(startnum)
  3988. CALL DELETE(bufname)     /* these 4 lines make wordwrap more consistent */
  3989. CALL savelines(bufname)
  3990. CALL readlines(bufname 1)
  3991. CALL wrapbuf(startnum)
  3992. RETURN
  3993.  
  3994.  
  3995. wrapbuf:
  3996. ARG startnum .
  3997. CALL cleanline(1)
  3998. IF startnum>=lynes.0 & LENGTH(lynes.startnum)<80 THEN RETURN
  3999. SAY pen3'Wordwrapping...'def
  4000. lynes.startnum=TRANSLATE(lynes.startnum,' ','09'x)
  4001. lynes.startnum=COMPRESS(lynes.startnum,'0C'x)  /* no FF */
  4002. DO wi=startnum WHILE wi<=lynes.0
  4003.   wj=wi+1
  4004.   lynes.wj=COMPRESS(lynes.wj,'08'x||'0C'x||'7F'x)
  4005.   tabpos=POS('09'x,lynes.wi)
  4006.   DO WHILE tabpos>0
  4007.     lynes.wi=DELSTR(lynes.wi,tabpos,1)
  4008.     lynes.wi=INSERT('  ',lynes.wi,tabpos-1)
  4009.     tabpos=POS('09'x,lynes.wi)
  4010.   END
  4011.   IF LENGTH(lynes.wi)>75 THEN
  4012.     DO
  4013.       testchar=''
  4014.       IF lynes.wj~='' THEN testchar=LEFT(lynes.wj,1)
  4015.       IF testchar=' ' | testchar='.' | testchar=':' THEN
  4016.         DO
  4017.           DO wjj=lynes.0 TO wi+1 BY -1
  4018.             wk=wjj+1
  4019.             lynes.wk=lynes.wjj
  4020.           END
  4021.           lynes.wj=''
  4022.           lynes.0=lynes.0+1
  4023.         END
  4024.       DO wl=WORDS(lynes.wi) TO 1 BY -1 WHILE LENGTH(lynes.wi)>74
  4025.         IF WORDS(lynes.wi)=1 THEN
  4026.           lynes.wi=LEFT(lynes.wi,74) SUBSTR(lynes.wi,75)
  4027.         lynes.wj=WORD(lynes.wi,wl) lynes.wj
  4028.         lynes.wi=STRIP(DELWORD(lynes.wi,wl,1))
  4029.       END
  4030.     END
  4031. END
  4032. RETURN
  4033.  
  4034.  
  4035. seelines:
  4036. ARG fancy .
  4037. DO i=1 TO lynes.0
  4038.   IF fancy=0 THEN SAY lynes.i||def
  4039.   ELSE
  4040.     DO
  4041.       IF LEFT(lynes.i,2)=': ' & WORDS(lynes.i)=2 THEN ITERATE i
  4042.       ELSE IF LEFT(lynes.i,10)='Directory ' | LEFT(lynes.i,5)='=====' THEN
  4043.         SAY pen3||lynes.i||def
  4044.       ELSE SAY lynes.i
  4045.       IF fancy=2 & colorflag=1 THEN
  4046.         DO
  4047.           IF searcharg~='' THEN
  4048.             DO
  4049.               testpos=POS(UPPER(searcharg),UPPER(lynes.i))
  4050.               IF testpos>0 THEN
  4051.                 SAY LEFT(' ',testpos-1)||pen3||lineup||UPPER(searcharg)||def
  4052.             END
  4053.           IF i=1 THEN
  4054.             IF WORD(lynes.1,3)='Reply' THEN
  4055.               DO
  4056.                 testpos=WORDINDEX(lynes.1,3)
  4057.                 SAY LEFT(' ',testpos-1)||pen3||lineup||SUBSTR(lynes.1,testpos)||def
  4058.               END
  4059.         END
  4060.     END
  4061.   IF i//linesperpage=0 & i<lynes.0 THEN
  4062.     IF waiting2() THEN LEAVE i
  4063. END
  4064. nonstop=0
  4065. RETURN
  4066.  
  4067.  
  4068. readlines:
  4069. CALL CLOSE(f)
  4070. PARSE ARG tempname readstart .
  4071. IF ~readopen(tempname) THEN RETURN 1
  4072. IF readstart<2 THEN lynes.=''
  4073. DO ri=readstart
  4074.   line=READLN(f)
  4075.   IF EOF(f) THEN BREAK
  4076.   lynes.ri=line
  4077. END
  4078. lynes.0=ri-1
  4079. CALL CLOSE(f)
  4080. DO ri=lynes.0 TO 0 BY -1 WHILE LENGTH(lynes.ri)=0 | LEFT(UPPER(lynes.ri),2)='/E' | LEFT(UPPER(lynes.ri),2)='/S'
  4081. END
  4082. lynes.0=ri
  4083. RETURN 0
  4084.  
  4085.  
  4086. savelines:
  4087. PARSE ARG tempname .
  4088. IF EXISTS(tempname) & edtype='MAIL' THEN
  4089.   DO
  4090.     ok=OPEN(f,tempname,'A')
  4091.     IF ok~=0 THEN CALL WRITELN(f,LEFT('',74,'^'))
  4092.   END
  4093. ELSE ok=OPEN(f,tempname,'W')
  4094. IF ok=0 THEN
  4095.   DO
  4096.     line='***' tempname 'failed to open for saving!'
  4097.     SAY line
  4098.     RETURN 1
  4099.   END
  4100. DO wi=1 TO lynes.0
  4101.   CALL WRITELN(f,lynes.wi)
  4102. END
  4103. CALL CLOSE(f)
  4104. RETURN 0
  4105.  
  4106.  
  4107. sortuserlist:
  4108. uf=bbspath'Lists/USERS'
  4109. IF sortuserflag THEN CALL DELETE(uf)
  4110. sortuserflag=0
  4111. IF ~EXISTS(uf) THEN
  4112.   DO
  4113.     users=bbsSortUsers.rexx(bbspath bbsname)
  4114.     RETURN
  4115.   END
  4116. ELSE
  4117.   DO
  4118.     IF OPEN(f,uf,'R')=0 THEN RETURN
  4119.     users=0
  4120.     DO i=1
  4121.       dat=READCH(f,65000)
  4122.       IF EOF(f) THEN LEAVE i
  4123.       users=users+WORDS(dat)
  4124.     END
  4125.     CALL CLOSE(f)
  4126.   END
  4127. SAY CENTER(RIGHT(users,8) 'Users on'pen3 bbsname,74)||def
  4128. RETURN
  4129.  
  4130.  
  4131. showuserlist:
  4132. IF data.5='' THEN line='Here are the EMail names of your fellow users.'
  4133. ELSE line='   'users 'users. Use these names to address messages.'
  4134. SAY pen3||line||def
  4135. CALL showtext(bbspath'Lists/USERS' 1)
  4136. IF data.5~='' THEN CALL waiting()
  4137. RETURN
  4138.  
  4139.  
  4140. msgcount:
  4141. ARG countdir .
  4142. lastmess=0
  4143. totmsgs=0
  4144. unred=0
  4145. IF ~EXISTS(msgpath||countdir) THEN RETURN
  4146. IF STATEF(msgpath||countdir)=msg.countdir.1 THEN totmsgs=msg.countdir.0
  4147. ELSE
  4148.   DO
  4149.     totmsgs=WORDS(SHOWDIR(msgpath||countdir))
  4150.     msg.countdir.0=totmsgs
  4151.     msg.countdir.1=STATEF(msgpath||countdir)
  4152.   END
  4153. IF countdir>level | FIND(data.21,i)>0 THEN RETURN
  4154. lastread.countdir=WORD(data.22,countdir)
  4155. IF ~DATATYPE(lastread.countdir,'W') THEN lastread.countdir=0
  4156. lastmess=countcheck('LastMessage'countdir 0)
  4157. IF lastread.countdir<0 THEN RETURN
  4158. firstmess=countcheck('FirstMessage'countdir 0)
  4159. IF lastread.countdir<firstmess THEN lastread.countdir=firstmess-1
  4160. IF lastmess>0 THEN
  4161.   IF lastread.countdir>=0 THEN
  4162.     DO
  4163.       IF lastread.countdir<(firstmess-1) THEN lastread.countdir=firstmess-1
  4164.       unred=lastmess-lastread.countdir
  4165.       IF unred>totmsgs THEN unred=totmsgs
  4166.       IF unred>0 | ~logonflag THEN
  4167.         DO
  4168.           cline=RIGHT(unred,5) 'new of' RIGHT(lastmess,5) 'messages,'
  4169.           cline=cline RIGHT(totmsgs,5) 'still online in' 
  4170.           cline=cline RIGHT(countdir,2)',' msg.countdir
  4171.           SAY pen6||cline||def
  4172.         END
  4173.     END
  4174. RETURN
  4175.  
  4176.  
  4177. counts:
  4178. SAY
  4179. SAY 'Working...'
  4180. SAY
  4181. temp=''
  4182. DO i=1 TO 4
  4183.   temp=temp||CENTER(copyright.i,75)||'0A'x
  4184. END
  4185. CALL SETCLIP('BBS_copyright',temp)
  4186. IF emailonline<0 THEN CALL countmail()
  4187. CALL bbsSTATS.rexx(name colorflag 0 emailonline grand grand2 files.0 users)
  4188. SAY
  4189. CALL waiting2()
  4190. IF waitchar='Q' THEN RETURN
  4191. CALL showmarked(1)
  4192. CALL logonstats()
  4193. nonstop=0
  4194. CALL waiting()
  4195. RETURN
  4196.  
  4197.  
  4198. countmail:
  4199. SAY '   Counting online email...'lineup
  4200. emailonline=0
  4201. t=SHOWDIR(bbspath'Users')
  4202. DO ti=1 TO WORDS(t)
  4203.   emailonline=emailonline+WORDS(SHOWDIR(bbspath'Email/'WORD(t,ti)))
  4204. END
  4205. SAY lineup'       'emailonline' letters online.'
  4206. RETURN
  4207.  
  4208.  
  4209. hourly:
  4210. IF level=99 & nonstop~=1 THEN
  4211.   DO
  4212.     IF getinput(1 1 'Zero The Hourly Averages? (Ny) > ')='Y' THEN
  4213.       ADDRESS COMMAND 'C:Delete >*' bbspath'Numbers/Hourly/#?'
  4214.     CALL cleanline(1)
  4215.   END
  4216. SAY lm
  4217. CALL ShowHourly.rexx(name linesperpage colorflag nonstop)
  4218. RETURN
  4219.  
  4220.  
  4221. logonstats:
  4222. IF level=0 THEN RETURN
  4223. SAY bak2||name||def 'Last on' DATE('W',lastondate,'I') DATE(,lastondate,'I') lastontime
  4224. tempnum=countcheck('LastFile' 0)-lastbrowse
  4225. IF tempnum>files.0 THEN tempnum=files.0
  4226. line=RIGHT(countcheck('LastFile' 0),5) 'uploaded,'
  4227. line=line RIGHT(files.0,5) 'files online.'
  4228. IF tempnum>0 THEN SAY RIGHT(tempnum,5) 'new of' line
  4229. ELSE SAY '   No new of' line
  4230. totmsg=0
  4231. grand=0
  4232. grand2=0
  4233. DO i=1 TO 99
  4234.   IF msg.i='' THEN ITERATE i
  4235.   CALL msgcount(i)
  4236.   totmsg=totmsg+unred
  4237.   grand=grand+totmsgs
  4238.   grand2=grand2+lastmess
  4239. END
  4240. line=RIGHT(grand2,5) 'messages,' RIGHT(grand,5) 'still online.' 
  4241. IF totmsg>0 THEN SAY RIGHT(totmsg,5) 'new of' line
  4242. ELSE SAY '   No new of' line
  4243. RETURN
  4244.  
  4245.  
  4246. readopen:
  4247. PARSE ARG fname
  4248. ok=OPEN(f,fname,'R')
  4249. IF ok~=0 THEN RETURN 1
  4250. line=fname 'failed to open for reading!'
  4251. SAY line
  4252. RETURN 0
  4253.  
  4254.  
  4255. writeopen:
  4256. PARSE ARG fname
  4257. CALL CLOSE(f)
  4258. ok=OPEN(f,fname,'W')
  4259. IF ok~=0 THEN RETURN 1
  4260. line=fname 'failed to open for writing!'
  4261. SAY line
  4262. RETURN 0
  4263.  
  4264.  
  4265. set_grand:
  4266. SAY 'Setting up public message conferences...'
  4267. grand=0
  4268. DO i=1 TO 99
  4269.   IF msg.i='' THEN ITERATE i
  4270.   msg.i.0=WORDS(SHOWDIR(msgpath||i,'F'))
  4271.   msg.i.1=STATEF(msgpath||i)
  4272.   grand=grand+msg.i.0
  4273. END
  4274. RETURN
  4275.  
  4276.  
  4277. SYNTAX:
  4278. FAILURE:
  4279. lin.1=''ERRORTEXT(RC)''
  4280. lin.2=SIGL-1     SOURCELINE(SIGL-1)
  4281. lin.3=SIGL ''SOURCELINE(SIGL)''
  4282. lin.4=SIGL+1     SOURCELINE(SIGL+1)
  4283. DO er=1 TO 4
  4284.   SAY lin.er
  4285. END
  4286. IF newpassword='' THEN SIGNAL DONE2  /* no user logged on, quit quietly */
  4287. CALL CLOSE(f)
  4288. IF level>sysoplevel THEN
  4289.   DO
  4290.     junk=getinput(1 1 'ReStart: (Ny) > ')
  4291.     IF junk~='Y' THEN SIGNAL LOGOUT
  4292.   END
  4293. string=''
  4294. waitchar=''
  4295. IF data.1~='' & data.5~='' & data.20~='' THEN CALL savedata(0)
  4296. SIGNAL RESTART
  4297.  
  4298.  
  4299. BREAK_E:
  4300. CALL CLOSE(f)
  4301. SAY pen3'*** CTRL-E BREAK ***'def
  4302. waitchar=''
  4303. string=''
  4304. nonstop=0
  4305. rnonstop=0
  4306. brostop=0
  4307. i=999999
  4308. wi=999999
  4309. ni=-1
  4310. SAY
  4311. RETURN 0
  4312.  
  4313.  
  4314. BREAK_C:
  4315. CALL CLOSE(f)
  4316.  
  4317. LOGOUT:
  4318. LOGOUT2:
  4319. secs=TIME('E')
  4320. mins=secs%60
  4321. secs=TRUNC(secs//60)
  4322. IF secs<10 THEN secs='0'secs
  4323. SAY
  4324. SAY 'Public messages now online: 'RIGHT(comma(grand),9)
  4325. SAY 'Public    files now online: 'RIGHT(comma(files.0),9)
  4326. SAY
  4327. SAY 'Time used this call:' mins':'secs
  4328. SAY
  4329. arg=bbspath'BBS_TEXT/GOODBYE'
  4330. IF EXISTS(arg) THEN
  4331.   DO
  4332.     CALL DELAY(14)
  4333.     nonstop=1
  4334.     CALL showtext(arg 0)
  4335.     nonstop=0
  4336.   END
  4337. SAY
  4338. IF bbsprefs.2 THEN CALL doGrin()
  4339. SAY 
  4340. IF EXISTS('rexx:bbsLOGOFF.rexx') THEN CALL bbsLOGOFF.rexx(name level 0)
  4341.  
  4342. OUT:
  4343. data.18=winnings
  4344.  
  4345. OUT2:
  4346.  
  4347. DONE:
  4348.  
  4349. DONE2:
  4350. CALL SETCLIP('BBS_LOCAL')
  4351. CALL SETCLIP('BBS_LOCAL_MSG')
  4352. IF newfilesflag=1 THEN
  4353.   DO
  4354.     newfilesdate=DATE('S') TIME()
  4355.     lastbrowse=countcheck('LastFile' 0)
  4356.   END
  4357. IF clear_marked=1 THEN data.24=''
  4358. CALL saveData(0)
  4359. IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') THEN
  4360.   DO
  4361.     IF sortalphaflag>0 | savefileflag>0 THEN
  4362.       CALL SETCLIP('BBS_QUICK_WAIT',1)
  4363.     ADDRESS AREXX bbsQUICKIN.rexx name level sysoplevel bbsprefs.6
  4364.   END
  4365. IF sortuserflag=1 THEN
  4366.   DO
  4367.     CALL sortuserlist()
  4368.     IF SHOW('P','BBBBS') THEN
  4369.       DO
  4370.         CALL SETCLIP('BBS_mainusers')
  4371.         CALL SETCLIP('BBS_localusers',1)
  4372.       END
  4373.     sortuserflag=0
  4374.   END
  4375. IF sortalphaflag>0 | savefileflag>0 | GETCLIP('BBS_resave_local')~='' THEN
  4376.   DO
  4377.     x=GETCLIP('BBS_resave_local')
  4378.     IF savefileflag>0 THEN CALL savefilelist2()
  4379.     ELSE IF x='' THEN CALL savealphalist()
  4380.     x=GETCLIP('BBS_resave_local')
  4381.     CALL SETCLIP('BBS_resave_local')
  4382.     IF x=1 THEN
  4383.       DO
  4384.         sortalphaflag=1
  4385.         savefileflag=1
  4386.         SIGNAL DONE2
  4387.       END
  4388.     IF SHOW('P','BBBBS') THEN CALL SETCLIP('BBS_localfiles',2)
  4389.     CALL SETCLIP('BBS_QUICK_WAIT')
  4390.   END
  4391. IF getinput(1 1 'Reset for next local user? (nY) > ')='N' THEN EXIT
  4392. clear_marked=0
  4393. data.=''
  4394. SIGNAL BIG_LOOP
  4395.  
  4396.  
  4397. checkclips:
  4398. IF GETCLIP('BBS_mainusers')~='' THEN
  4399.   DO
  4400.     CALL sortuserlist()
  4401.     CALL SETCLIP('BBS_mainusers')
  4402.   END
  4403. IF GETCLIP('BBS_mainfiles')~='' THEN
  4404.   DO
  4405.     CALL SETCLIP('BBS_mainfiles')
  4406.     CALL loadfiles()
  4407.     CALL loadalpha(1)
  4408.   END
  4409. RETURN
  4410.  
  4411.  
  4412. checkalias:
  4413. addressee=''
  4414. IF alias.0=0 THEN RETURN 0
  4415. DO i=1 TO alias.0
  4416.  IF UPPER(alias.i)=UPPER(string) THEN
  4417.   DO
  4418.    addressee=realname.i
  4419.    LEAVE i
  4420.   END
  4421. END
  4422. IF addressee='' THEN RETURN 0
  4423. string=''
  4424. SAY pen3'Email to 'def||addressee
  4425. CALL editor('MAIL' addressee)
  4426. RETURN 0
  4427.  
  4428. /* bbsLOCAL.rexx */
  4429.